Not sure what I’m doing wrong here. Trying to do a character movement script. He’s moving fine, animation is playing, he is colliding with things and has gravity applied. But when he collides with stuff he starts to roll around since the character is pretty much just a ball with arms. I tried using the rigid body constraints and freezing the rotation to stop him from rolling around but it doesn’t seem to work. Any ideas on what I’m doing wrong.
var speed : float = 5.0;
function Update ()
{
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
rigidbody.constraints = RigidbodyConstraints.FreezePositionZ;
if(Input.GetButton("MoveRight"))
{
animation["Walk"].speed = 1.5;
animation.Play("Walk");
transform.Translate(Vector3.right * Time.deltaTime * speed);
}
}