- Home /
How to move Character along world floor?
i have a character (3rd person) and i want him to walk along the world so i can stop it from climbing steep hills because every time i go to walk into a wall he just goes straight through it (the wall has a collider) this does it with every object i try it with, i walk into a cube and my character just fly's straight into the air on top of it. if anyone knows another solution to my problem a answer would be amazing thanks
What's your character? A CharacterController, a Rigidbody or none of them?
I use a rigid body component but I use transform.translate to move
Answer by Loius · Jan 31, 2013 at 10:53 PM
Don't use transform.position or transform.Translate, those are equivalent to teleportation. Use CharacterController.Move or SimpleMove, or Rigidbody.AddForce instead.
Would this fix my problem? I'm at my pc at the moment so I can't check
I don't know, would it? Are you currently using position or translate? 'Cause those are equivalent to teleportation and as such they will absolutely disregard all collision. Addforce makes a rigidbody move according to physics and charactercontroller's move and simplemove are like translate except they won't go through things.
Answer by aldonaletto · Jan 31, 2013 at 10:57 PM
As @Loiuzein said, you should not modify the position of a rigidbody directly or via Translate. Use Rigidbody.AddForce, but set a reasonable Drag value, or your character will not stop moving when you remove the force.