I have a gameObject that I am trying to get the rotation.x of. This is then to be saved to an integer called velocity. The problem is, I am getting the 'Expressions in statement must only be executed for their side-effects" error. I know this means that my code isnt doing anything and this may be due to C# handling the integer in a certain way that is different to unityscript.
The code is as follows:
var changeType : changeMaterialType; var catapult : GameObject; var velocity : int; function Start(){ velocity = 0; } function Update () { velocity == catapult.transform.rotation.x; if(rigidbody.isKinematic == false) { if(constantForce.force.y >= -50) { gameObject.constantForce.force.y -= changeType.currentProjectile.rigidbody.mass * 10/velocity; } if(constantForce.force.z <= 10 && constantForce.force.z >= 0) { gameObject.constantForce.force.z += 1; } if(constantForce.force.z == 10) { gameObject.constantForce.force.z -= 2; } } }
I have the velocity int starting at 0 and want it to be equal to the rotation of my catapult gameobject when updating.