hi,
which command to use to get the “local y axis angle value” of an object ( local because this object has a different orientation ) and pass (set) this value to another object rotate in the same axis and with the same value?
hi,
which command to use to get the “local y axis angle value” of an object ( local because this object has a different orientation ) and pass (set) this value to another object rotate in the same axis and with the same value?
Probably just transform.localRotation. It returns a quaternian, but you should be able to pass it to another transform.
transform.localRotation = Quaternion.identity; ???
and how to use it properly?
That was only an example. You can use:
Quaternion temp = Player.transform.localRotation;
AnotherGameObject.transform.localRotation = temp;
if localRotation doesn’t work, you may just want to use Rotation.
and how to get/set only the y axis?
Vector3 playerV = Player.transform.eularAngles;
Vector3 anotherV = AnotherGameObject.transform.eularAngles;
AnotherGameObject.transfrom.eularAngles = new Vector3(anotherV.x,playerV.y,anotherV.z);
it was not working because I was trying to copy the angle value of an another object rotating in other orientation ( that is what I need ) as i said “from the beginning”
so instead of doing that I did this another object child of an empty object and changed the empty object orientation
now I can get the correct local value of this child and pass to any object rotate with the same value because now the angle values match.
thanks anyway!