tim12345 Guest |
Quote
|
2015-02-07 07:49:23 |
|
Hi, I'm having some trouble getting an accurate rotation y coordinate when using an enemy with AI that is randomly patrolling. I can get an accurate coordinate values when an object is simply rotating or following a path, but with the random patrol... something doesn't seem right. Can you check these numbers and see if they look right to you? http://timiscool.net/rotations.html It seems as though the y coordinate never goes above or below 90...
|
niko Moderator |
Quote
|
2015-02-08 08:57:03 |
|
Where you get those values from, directly from the scene node?
I think those rotations are still correct: You get values between -90 and 90 for y, and the x and z values change additionally. You can express the same rotation with different euler angles, this is what happening here.
The AI is internally using a quaternion, which is converting the rotation it wants to euler coordinations, and this is the result you get then. This has been done in order to remove possible gimbal locks. (See here:http://en.wikipedia.org/wiki/Gim...)
|
tim12345 Guest |
Quote
|
2015-02-08 22:39:45 |
|
Very interesting. Euler coordinations...that would explain it then. Is there a way through javascript to convert them back to more traditional coordinates?
|
niko Moderator |
Quote
|
2015-02-09 21:09:50 |
|
Yes, you could download the CopperLicht SDK, in there you'll find the source of the quaternion class used, which is the same for all targets. It has functionality to convert from and to those rotations. Alternatively, rotate a vector by this, and calculate the rotation you need again from that.
|