All arrive at the same time :-)

Hi all,

I’m sure to someone this is quite simple, but confuses me.
I lerp my game object to a location which is fine.
I also sleep it’s rotation.

What confuses me is how I can make sure it reaches it’s position at the same time as it’s final rotation.
i.e. I wish it to rotate from an angle to another angle over the time it takes it to lerp from a position to another.

The objective being that it reaches it’s destination and rotation at the same time.
I’m sure some maths fan can help! :slight_smile:

Appreciated

Cheers

Hi, without checking the script all i can say is :
Maybe you need to multiply the rotation speed .

Example : rotation * 10;
Do not use the same var for walking speed and rotation speed or if you use, dont multiply the Walking Speed.

Hope that works for you :slight_smile:

Sure,
But the distance can vary between Lerps; so I need to compute ‘how much to rotate’ per item.
I could just get the distance from source to dest of lerp. But how do use that to know how much rotation is required in x,y and z so that at destination I am at the angle I require on all 3 axis?

Cheers

Oh, im not sure, but you could use a Loop.
Example:
In the case of using Javascript.
You need to set a public var ( i think the best way is instanciating the script)
public var distanceX : float;
And then use a Loop for cover the actual position to the distanceX.

Sorry if I’m misunderstandig You.

Lol,
How do I compute the rotations needed around all 3 axis to get from a starting rotation to and ending rotation over a period of time.

Cheers

Uh, I’m being shamelessly self-promoting, but this is a valid advice: you might use a tween engine (iTween or HOTween) :stuck_out_tongue: