rotation / position problem

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
dieter
Posts: 4
Joined: Tue Mar 04, 2008 8:32 am

rotation / position problem

Post by dieter »

Hi

(already sent to the wrong forum?)

sorry - its not a very good topic

I am trying to implement a google earth similar movement in my own application. I ve started based on cityfly and it looks most the time really good; but when I have a pitch of about 90 deg. and then a heading of about 90 deg. my translation goes wrong (instead of going to the left it goes to the front ...).

I use (like cityfly) sbdata [3] and sbdata[4] (sbdata[5] = roll = 0) directly for the rotation -
for the translation I use:
SPW_ArbitraryAxisToMatrix (Rd, sbdata + 3, 1.0f);

SPW_Mult44x44 (Spw_World_to_eye, Spw_World_to_eye, Rd);

Spw_World_to_eye[3][0] -= sbdata[0];
Spw_World_to_eye[3][1] -= sbdata[1];
Spw_World_to_eye[3][2] += sbdata[2];

SPW_InvertMatrix (eye_to_world, Spw_World_to_eye);
pos [0] = eye_to_world[3][0];
pos [2] = -eye_to_world[3][1];
pos [1] = eye_to_world[3][2];

I use a different coordinatesystem, therefore I have switched same axis and directions.

Could s.o. give me a hint what iI'm doing wrong or can give me another way how to impelement it in my app.

Thanks

Dieter
jwick
Moderator
Moderator
Posts: 3455
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

If the translations don't respond to the new view you have, the translations are not being rotated by the new view rotation matrix.

You have to determine precisely what coordinate system your translations (pos) are expressed in. It is probably the world coordinate system. The translation values from the 3Dx device have to be transformed from the eye space to the world space, then applied to your world space pos values.

You have an additional problem of having a different coordinate system naming convention than we used (Z up). This is just a naming convention. The math should work the same, but you'll have to be conscious of what the axes are being called at any given time.
Post Reply