How would you make an object move based on the objects rotation, I have this:
if(engineReady){
float tempPitch = pitch / 1.66666f;
tempPitch = (tempPitch - 30.0f) / 100.0f;
pitchDegrees = tempPitch;
heliSpeed = Mathf.Abs((tempPitch * 100.0f));
heli.transform.rotation = new Quaternion(pitchDegrees, heli.transform.rotation.y, heli.transform.rotation.z, heli.transform.rotation.w);
if(curHeight < 0.01){ heliSpeed = 0.0f; pitch = 50; }
if(pitch > 50){
heli.transform.position += Vector3.forward * (heliSpeed * Time.deltaTime);
} else {
heli.transform.position -= Vector3.forward * (heliSpeed * Time.deltaTime);
}
}
// ===== Yaw ======= //
if(Input.GetKey(KeyCode.Z)){
if(engineReady){
heli.transform.rotation = new Quaternion(heli.transform.rotation.x, heli.transform.rotation.y + 0.05f, heli.transform.rotation.z, heli.transform.rotation.w);
}
}
if(Input.GetKey(KeyCode.C)){
if(engineReady){
heli.transform.rotation = new Quaternion(heli.transform.rotation.x, heli.transform.rotation.y - 0.05f, heli.transform.rotation.z, heli.transform.rotation.w);
}
}
But .forward always follows the global Z axis.