Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / Euler-Rotation to Direction (Coordinate Convention of AGK)

Author
Message
Sandwich
1
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 27th Sep 2017 12:32
Hi at all,

I just tried to control a space ship (3D physics) via

The problem is, that dirX, dirY and dirZ are coordinates in the global coordinate system. So the velocity direction is dependant on the ship's euler angles.

As far as I read the manual, there is no command to get an object's current "looking direction", so I need to transform the three euler angles to a (normalized) 3D-Direction (x, y, z).
There are lots of formulas on the web, but I don't know the exact axis convention of AppGameKit to choose the right one.

Thanks in advance,
Sandwich
Sandwich
1
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 28th Sep 2017 11:07
Not the right way - according to performance - but it works great:
Mr Bigglesworth
10
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 2nd Oct 2017 00:17 Edited at: 2nd Oct 2017 00:17
So to calculate the direction of an object you can use its rotation and a little math to get the answer. I haven't used dbPro in a long time so here is some pseudo-code:

The sine and cosine functions may take radians instead of degrees so you may have to convert them using X=PI/180
Sandwich
1
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 3rd Oct 2017 11:24
Thanks a lot, I'll give it a try!

Login to post a reply

Server time is: 2018-12-12 23:13:58
Your offset time is: 2018-12-12 23:13:58