Hellos,
transform.InverseTransformDirection(rigidbody.velocity).x = Mathf.Clamp( (transform.InverseTransformDirection(rigidbody.velocity).x), -3.0f, 3.0f);
I need to write this code for my car but I can’t. It give me a warning and it doesn’t work. Warning is : “Assignment to temporary.”
I can write just this :
this.rigidbody.velocity.x = Mathf.Clamp( this.rigidbody.velocity.x, -3.0f, 3.0f);
but this is not my car’s velocity.(not local space) It is world space’s velocity. I need assign variable to my car’s local space.
In addition, my purpose is that, if my car drift in X axis too much, I want stop it’s drifting.
What should I do ?
Thanks for helps