I am trying to move a Rigidbody forward in local coordinates, I mean, if I rotate it I want it to move in his local X axis.
I have tried this, but it moves in global coordinates:
Rigidbody player = GetComponent<Rigidbody>();
Vector3 movement = new Vector3 (1.0f, 0.0f, 0.0f);
movement = movement.normalized * 2 * Time.deltaTime;
player.MovePosition(transform.position + movement);
I don't know how to make the change to local coordinates.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…