- Home /
Question by
Benifir · Sep 06, 2013 at 02:17 PM ·
c#error-messagephysics settingsreturn type
Error Changing Rigidbody Velocity
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.
Comment
Best Answer
Answer by ArkaneX · Sep 06, 2013 at 02:32 PM
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...
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Full screen camera missing? 3 Answers