I am making a moving platform, and whenever my player gets on it, it starts flipping around. It also slowly rotates if I just leave it for a while. I want it to stay at the same rotation, but still move and be solid. This is my code for it:
void FixedUpdate () {
if (directionality == 1) {
Vector3 movement = new Vector3 (-1.0f, 0.0f, 0.0f);
rigidbody.velocity = movement * speed * Time.deltaTime;
}
if (directionality == 2) {
Vector3 movement = new Vector3 (0.0f, 0.0f, 1.0f);
rigidbody.velocity = movement * speed * Time.deltaTime;
}
}
↧