Comments and answers for "Switch force from horizontal to vertical"
http://answers.unity.com/questions/675978/switch-force-from-horizontal-to-vertical.html
The latest comments and answers for the question "Switch force from horizontal to vertical"Comment by thenachotech1113 on thenachotech1113's answer
http://answers.unity.com/comments/675993/view.html
thanks a lot, it is actualy a 3d game but i dont need the plane engines to rotate left and right, at lest for now. but thanks for noting that, since its a 3d game, i should probably take in account that when i use the actual engine rotation it should use localRotation.Fri, 28 Mar 2014 23:55:28 GMTthenachotech1113Answer by robertbu
http://answers.unity.com/answers/675986/view.html
One issue is that Mathf.Cos() and Mathf.Sin() takes radians for input, not degrees, so this line should be:
vectorThrust = new Vector3 (thrust * Mathf.Cos(thrustDir * Mathf.Deg2Rad), thrust * Mathf.Sin(thrustDir * Mathf * Deg2Rad), 0);
Note as an alternative, you could do use an Quaternion.AngleAxis() for the rotation. Something like:
vectorThrust = Quaternion.AngleAxis(thrustDir, Vector3.forward) * Vector3.right;
Based on your code above, I'm assuming this is a 2D game. I don't know your specific setup. You may want to use another base vector (Vector3.left, Vector3.down), and you may need Vector3.back instead of Vector3.forward. But the concept is the same. You are just picking some base vector and rotating it around the word 'z' axis by angle.Fri, 28 Mar 2014 23:38:57 GMTrobertbu