- Home /
How to set gravity for model?
Hi. I just create script to my enemy model. Script:
myTransform.position += myTransform.forward movementSpeed Time.deltaTime;
but my enemy is just flying. 0 animations, 0 gravity. What can I do?
Comment
You need to change your movement code from modifying the transform to using a Rigidbody, or you will need to write code that simulates gravity.
Answer by meat5000 · Sep 22, 2013 at 01:19 PM
if I use rigidbody my enemy model makes push-ups on his backside. It looks like bowling ;)
Consider using a Character Controller. The sample scripts at CharacterController.$$anonymous$$ove() and CharacterController.$$anonymous$$oveSimple() take care of gravity.
Could you give me example of using it? I have no idea how I can use it in my script