Page 1 of 1

Physics while moving up and down

Posted: Mon Apr 13, 2015 12:37 pm
by nikolaiko
Hi, I have question about moving up and down on the hill. Is there any ways to make move slower then moveing up the hill and faster then going down?

Thanks.

Re: Physics while moving up and down

Posted: Mon Apr 13, 2015 5:15 pm
by Norbo
One option would be to use the CharacterController.SupportFinder.SupportData.Normal. The normal points away from the character at the point of contact, so you can take the desired horizontal movement direction of the character in world space and dot it against the normal. A value of near zero is walking on a horizontal plane. If the value is closer to 1, that means the character is walking uphill. If the value is closer to -1, the character is walking downhill. That value can be used to change the CharacterController.SpeedScale (or other specific speed properties).

You could also adjust forces with that value. Or, if the character's movement forces are set low enough, gravity will slow down/speed up the acceleration by itself.

Re: Physics while moving up and down

Posted: Wed Apr 15, 2015 6:30 am
by nikolaiko
Thanks!

I will check second option and if gravity doesn't slow movement I will try first option.