Calling all programer gurus!!
I am new to programming (started about 7 months) and I am starting to get the hang of it now.
I am trying to build my own character controller so I can understand how to apply physics etc,
My question is how does .SimpleMove apply gravity?
forward = transform.TransformDirection (Vector3.forward);
curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove (forward * curSpeed);
this section of the cade is where the gravity is applied. But I don’t understand how.
Can anyone explain this to me?
The full code can be found here Unity - Scripting API: CharacterController.SimpleMove
Thanks
Did you ever find out?
I am currently trying to make gravity apply to my NPCs. They wander about with a script that uses SimpleMove, and they will fall towards the ground, just very slowly. This means they can walk down a hill, but if they attempt to run down the hill, they will run off the terrain and glide through the air.
The answer to the question can be found here
“SimpleMove takes the speed as parameter and will move the character accordingly. On top of that, the character will respond to gravity. That’s the only physic you’ll get with the Character Controller. The downside is that the Y axis velocity is ignored by this method”
SimpleMove is not applying gravity. The physics system is applying gravity via the rigidbody component attached to the gameobject.