Monitoring rotation and apllying it to something else.
Hi i have a gameoject that rotates, i would like to constantly monitor its rotation on the y axis and apply it to another gameobject.
How do I do this?
Thanks.
Answer by tormentoarmagedoom · May 08, 2019 at 04:06 PM
Hello @smindlon
This is Unity Answers. We are here to help. But you should take your time trying to solve your own problems. Your question is from lesson zero. Its more than basic. You should go to take your time watching tutorials about basics in unity.
You need to read and then apply rotation of an object in euler form (x,y,z) (Normally, rotation is represented in Quaternion variables, but its so much easy to operate in euler)
Then to apply a rotation component value to an object, you will need to create a new vector, so lets change the Z rotation component of an object called QWER, apllying the Z rotation of an object called ASDF
float Xrot = QWER.transform.eulerAngles.x;
float Yrot = QWER.transform.eulerAngles.y;
float Zrot = ASDF.transform.eulerAngles.y;
QWER.transform.eulerAngles = new Vector3 ( Xrot, Yrot, Zrot);
Good luck!
And remeber: learn > try > learn > try...
Your answer
Follow this Question
Related Questions
Bugs, bugs and bugs again! 0 Answers
have enemy try to get in front of player and push them back help 0 Answers
How to make the object return to its last angle (before the angle limit) go back no so abruptly ? 0 Answers
How can I flip a player over the Horizontal and Vertical axis? 0 Answers
Align two cameras to a fixed position 0 Answers