- Home /
Question by
Jetzz · Mar 16, 2014 at 11:53 PM ·
javascriptoptimizationcars
BCE0034: Expression in statements must only be executed for their side-effects
#pragma strict
var wheelFL : WheelCollider;
var wheelFR : WheelCollider;
var wheelRL : WheelCollider;
var wheelRR : WheelCollider;
var maxTorque : float = 50;
var Speed = 10;
function Start () {
}
function Update ()
{
wheelFR.motorTorque * Input.GetAxis ("Vertical") * Speed;
wheelFL.motorTorque * Input.GetAxis ("Vertical") * Speed;
}
And the problem is in * Speed
Comment
Best Answer
Answer by Bunny83 · Mar 17, 2014 at 12:11 AM
List 14 and 15 are just float expressions which aren't used in any way. I guess the first "*" should be a "=" so you calculate Input.GetAxis ("Vertical") * Speed
and assign it to wheelFR.motorTorque
So the two lines
wheelFR.motorTorque * Input.GetAxis ("Vertical") * Speed;
wheelFL.motorTorque * Input.GetAxis ("Vertical") * Speed;
would become:
wheelFR.motorTorque = Input.GetAxis ("Vertical") * Speed;
wheelFL.motorTorque = Input.GetAxis ("Vertical") * Speed;
// | | | |
// | | | |
// variable_______/ | | |
// assignment operator__/ \_________________________________/
// float expression________________________/
Thanks Bunny83 I solved that problem but now the car dont move anyway , never did it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140426im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Multiple Cars not working 1 Answer
Faux Gravity problem? 1 Answer
How Do I Make A Health Bar 6 Answers