Answers for "Transform.Translate not moving in the direction of specified vector"
http://answers.unity.com/questions/1427696/transformtranslate-not-moving-in-the-direction-of.html
The latest answers for the question "Transform.Translate not moving in the direction of specified vector"Answer by Bunny83
http://answers.unity.com/answers/1427791/view.html
Please if you have trouble with any built in method you should [first check the documentation][1].
<br>
> Moves the transform in the direction
> and distance of translation.
<br>
> If relativeTo is **left out or set to**
> **Space.Self** the movement is applied
> relative to the **transform's local**
> **axes**. (the x, y and z axes shown when
> selecting the object inside the Scene
> View.) If relativeTo is Space.World
> the movement is applied relative to
> the world coordinate system.
So you pass in a world space direction but it's applied in local space which doesn't make much sense. The resulting direction would be twice the angle relative to the world forward.
So either use
Vector3 move = transform.forward * stickDirection.sqrMagnitude * moveSpeed;
cube.transform.Translate(move * Time.deltaTime, Space.World);
or
Vector3 move = new Vector3(0f, 0f, stickDirection.sqrMagnitude * moveSpeed);
cube.transform.Translate(move * Time.deltaTime);
ps: declaring a variable 7 constant like this "nothing" is just confusing. Just use Vector3.zero which is (0, 0, 0). For more predifined constants [see Vector3][2]
[1]: https://docs.unity3d.com/ScriptReference/Transform.Translate.html
[2]: https://docs.unity3d.com/ScriptReference/Vector3.htmlMon, 30 Oct 2017 11:16:40 GMTBunny83Answer by nihohit1
http://answers.unity.com/answers/1427719/view.html
Could this object be the child of a rotated object? In such a case, the child is translated relative to its parent rotation and scale.Mon, 30 Oct 2017 09:20:43 GMTnihohit1