- Home /
Adding Rotation to a Gameobject
Hi I have My HTCVive and I want to have the Object(a gun) extra rotated like the position down in the code. The controller is the Vive controller Changing its position (so the Gun should "replace" the controller) but i need to rotate it because now it would shoot straight upwards
The code is the following
objectInHand.transform.rotation = thisController.transform.rotation + new Vector3 (0, 0.01F, 0);
objectInHand.transform.position = thisController.transform.position;
how can i add extra rotation, lets say 120 at the z axis, 40 at the x and 20 at the y ?
Answer by Thaldin · Dec 29, 2017 at 11:23 PM
You could try to use a Qaternion and add it to the "objectInHand.transform.rotation". As far as I know it will be handled like a Vector3.
Your answer
Follow this Question
Related Questions
Camera rotation the same as player rotation 1 Answer
The best way for working with rotation in 2d game 1 Answer
Instantiate GameObject towards player 0 Answers
Auto leveling help 0 Answers
Rotate back to original x rotation 1 Answer