- Home /
Why is rotation offset
If i use this code
transform.position= Vector3.zero+Vector3(0,0,1);
Now In the inspector I rotate the y value and the obejct has its own axis.
If I use this
transform.position= Vector3.zero+transform.TransformDirection(0,0,1);
Now In the inspector I rotate the y value and the obejct rotates on the Vector3.zero Axis as it would be parented on the first Vector. In this case vector3.zero
Why is this?? Its Possible to use :
transform.position= Vector3.zero+transform.TransformDirection(0,0,1);
BUT TO USE THE OWN OBJECT AXIS ?????
Answer by srivello · Nov 02, 2016 at 12:04 PM
Hi Psyhova,
There are many options with how to alter transform (position, scale, rotation).
One option is to treat movement and rotation separately like this.
transform.position = new Vector3
(
transform.position.x + 10,
transform.position.y,
transform.position.z
);
transform.Rotate(new Vector3( 1, 2, 3), 45, Space.World);
Enjoy!
-Sam
Your answer
Follow this Question
Related Questions
My object is translating with speed but does not stop... 1 Answer
transform.Translate() effect is being reverted 0 Answers
Vector2.moveTowards but only on one axis 1 Answer
How to shift the player to a definite position in the x-axis using key presses? 1 Answer
Moving an object on different axis? 1 Answer