Steer Lock for Car

So i’m following a tutorial on youtube for making a car game and the tutorial is in javascript but I know C# so i’m converting it to C# as I go. There’s a line of code I can’t figure out how to convert to work in C#, the following line is:

wheelFRTrans.localEulerAngles.y = wheelFR.steerAngle;

it provides me with an error “Assets/Scripts/CarControlScript.cs(45,17): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer”

I can’t quite figure out how it should be laid on for C#, I know i’m being really dumb about this.

Need an answer as soon as possible.

Thanks :wink:

Could you post what tutorial are you following? If i can take a look, maybe i can get that for you.

This video, http://www.youtube.com/watch?v=a6LgepzXIjw

I had a similar problem with setting the centerOfMass but that was easier to figure out than how to fix this.

I understand what’s going on, I just don’t quite know the correct syntax to use.

I fixed it, the code was this,

wheelFRTrans.localEulerAngles = new Vector3(0, wheelFR.steerAngle, 0);

All errors are gone and the wheel behaves as it should.

Turns out doing this causes the rotation of the front wheels to stop so have you any ideas?

1 Like