HELLO i am prototyping some game and i have a little probleme and i need your help.
i have a moving cube and i want to lift that cube at a certain angle say 50° and keep that angle (using addtorque) while the cube is moving forward any idea ?
//public float _stabTargetAngle;
public float stabValue;
//public float stabValue2;
//public float stablizeFactor = 1f;
// public float yRotation = 5.0F;
public float angle;
void Update() {
/*float num = Mathf.DeltaAngle(this.transform.localEulerAngles.z, this._stabTargetAngle);
this.stabValue = num;
this.rigidbody.AddRelativeTorque(0.0f, 0.0f, stabValue2);//num * this.stablizeFactor * this.rigidbody.velocity.z
*/
angle = transform.eulerAngles.z;
if (Input.GetMouseButton (0)) {
Debug.Log ("Pressed left click.");
this.rigidbody.AddRelativeTorque (0.0f, 0, stabValue);
}
if (Input.GetMouseButton(1)){
Debug.Log("Pressed right click.");
this.rigidbody.AddRelativeTorque (0.0f, 0, -stabValue);
}
if (Input.GetMouseButton (2)) {
Debug.Log ("Pressed middle click.");
print(angle);
}