I am getting the following error. I cannot figure out what I’ve done wrong, as I am not familiar with using transform.rotation:
Assets/SpaceMovement.js(55,45): BCE0022: Cannot convert ‘UnityEngine.Vector3’ to ‘UnityEngine.Quaternion’.
and
Assets/SpaceMovement.js(55,45): BCE0022: Cannot convert ‘UnityEngine.Vector3’ to ‘UnityEngine.Quaternion’.
Here is the code in which it is occurring, I am attempting to make a spaceship’s x and z rotation to be 0:
function Equalize(){
//Equalize x rotation
var e = true;
var q : float;
while (e == true){
q = Mathf.Round(transform.rotation.x);
Debug.Log("x is " + q);
transform.rotation = Vector3(q + 1, transform.rotation.y, transform.rotation.z);
if (transform.rotation.x == 0){
e = false;
}
}
//Equalize z rotation
e = true;
while (e == true){
q = Mathf.Round(transform.rotation.z);
Debug.Log("z is " + q);
transform.rotation = Vector3(transform.rotation.x, transform.rotation.y, q + 1);
if (transform.rotation.z == 0){
e = false;
}
}
}