I’m trying to make a script for a homing missile, but the rotation when reaching 270 degrees seems to be messed up, my code (for testing purposes right now):
void FixedUpdate () {
transform.LookAt (trans.position); //face the target
transform.rotation = new Quaternion(0,0,transform.rotation.z, transform.rotation.w); //x and y set to 0 since we want to rotate only the z axis
}
But when the z axis reaches 270 degrees it just flips and faces the opposite direction, i dont know what else to try right now.