rigidbody.angularVelocity.y = 0; gives off the error:
Cannot modify a value type return value of `UnityEngine.Rigidbody.angularVelocity’. Consider storing the value in a temporary variable.
First project working on detailed relistic physics.
rigidbody.angularVelocity.y = 0; gives off the error:
Cannot modify a value type return value of `UnityEngine.Rigidbody.angularVelocity’. Consider storing the value in a temporary variable.
First project working on detailed relistic physics.
You should retrieve the vector first, modify it and then assign back to rigidbody angular velocity:
var velocity = rigidbody.angularVelocity;
velocity.y = 0;
rigidbody.angularVelocity = velocity;
If you did a quick search here or in google, you’d find a lot of similar questions…