Hi,
I have this function that rotates the top half of the Mech back facing forward to match the bottom half after an attack -
function rotateTurret(){
var lookPos = transform.forward;
var rotation = Quaternion.LookRotation(lookPos);
rotation *= Quaternion.FromToRotation(Vector3.up, Vector3.right);
rotation *= Quaternion.Euler(XattackDegrees, YattackDegrees, 0);
mechTurret.rotation = Quaternion.Slerp(mechTurret.rotation, rotation, Time.deltaTime * 2);
}
What I want to do is covert it into a while function, I thought I could add something like -
while(mechTurret.rotation != transform.forward){
But Unity wont allow that, or -
while(mechTurret.rotation != transform.rotation){
But Unity wont allow that ether, can someone point me in the right direction please, thanks.
– Graham-Dunnetttransform.forwardis aVector3andmechTurret.rotationis aQuaternion. You cannot compare these against each other.What about - while(mechTurret.rotation != transform.rotation){
– Griffo