- Home /
using MoveObject to perform 2 translations at the same time
im currently using the MoveObject.js script (MoveObject) to move the player object towards the mouse every click with:
if (Input.GetButtonDown("Fire1"))
{
MoveObject.use.Translation(transform, transform.forward*1.5, 2, MoveType.Speed);
}
Im using this method because so far its the easiest way ive found to move the object relative to rotation and get a clean movement. What im trying to do with it now is to get the same forward like movement but with an upwards transform at the same time (the character jumps in an arc) but have been unable to get this to work in a singe use.Translation and trying to use to separate calls like:
if (Input.GetButtonDown ("Fire2"))
{
MoveObject.use.Translation(transform, transform.forward*4, 2, MoveType.Speed);
MoveObject.use.Translation(transform, Vector3.up*3, 2, MoveType.Speed);
}
has so far been completely unsuccessful. Is there anyway to get these 2 movement working fluidly together or should i be looking for a better method.
Answer by Piat · Dec 16, 2011 at 02:30 AM
managed to figure it out myself, with the help of syclamoth. obvious answer is obvious.
function Jump(){
moveUp = transform.forward*3 + Vector3.up*3;
moveDown = transform.forward*2 + Vector3.down*3;
yield MoveObject.use.Translation(transform, moveUp, 14, MoveType.Speed);
MoveObject.use.Translation(transform, moveDown, 20,MoveType.Speed);
}