- Home /
Question by
goldphoenix · Feb 24, 2013 at 04:26 PM ·
movementcharactermotorcharacter.move
physical character movement
when i use transform.Translate() chracter can move but when it hit a collider , can't stop moving and keep moving inside the collider. what should i do? sorry for my bad eglish.
Comment
Does your collider have a rigidbody? Check my answers here :
Answer by goldphoenix · Feb 25, 2013 at 08:24 AM
yes it has rigidbody.
i found answer
we should use this code:
var Controller : CharacterController;
function Update () {
if(Input.GetAxis("Vertical"))
{
//transform.Translate(Vector3.forward*WalkSpeed*Input.GetAxis("Vertical"));
Controller.Move(transform.forward*0.09*Input.GetAxis("Vertical"));
}}
Ok, in future it would be good to state you are using a character controller. This is very different from just using colliders and rigidbodies.
Answer by MTalhaAli · Mar 29, 2020 at 01:22 PM
what if i need to move its legs also forward and back