Changing object direction

Hello,

I am trying to create a ski track simulation. I have created simple AI for skiers to find the best direction to move in specific moment, but I don’t know how to make him changing his direction.

I add him some force in the beginning to move, and then I would like to let gravity accelerate him (like on a real slope you don’t put any additional power while riding down).

So my problem is that I don’t know how to change his direction. I can turn him using this code:

skier.rotation = Quaternion.Lerp (skier.rotation, Quaternion.AngleAxis (angle, Vector3.up), Time.deltaTime);

but when I do he is looking at properly direction, but still going straight down. I think I should then put some force to move him forward in new direction, but this way I disturb his natural speed. I can also manipulate his position, but this also makes him ‘faster’.

Finally I can manipulate with forces to keep his speed about some level, but is there any better possibility to turning him?

You could always try to rotate the Rigidbody.velocity of the skier. That way he will retain his speed, but the velocity will be directed in the new direction.

1 Like

This is it!
Thanks a lot! :slight_smile: