For some reason I’m unable to adjust the “motor” value of a wheeljoint2D.
public JointMotor2D motor;
//...
void Start() {
this.motor = this.gameObject.GetComponent<WheelJoint2D>().motor;
}
void Update() {
this.motor.motorSpeed = -1000f;
Debug.Log(this.motor.motorSpeed); // this will print "-1000f" but nothing happens
}
The above code prints “-1000f” just fine, but in the inspector the motor speed remains 0.
If I adjust the motor speed in inspector, the wheel starts rotating just fine.
Any idea what could be wrong? (Using unit y4.6.1f1)