Orientation in m3g

Forum for discussion on 3D games for mobile platform and doubts related to M3G, Mascot capsule and other rendering engines.

Orientation in m3g

Postby ladty » Thu Jul 24, 2008 5:50 pm

Hello again,
I'd like to ask you, do you have some function to convert rotation (like it is in 3ds max) to orientation (like it is in m3g) and back? It's really confusing to have 4 parameters in setOrientation instead of 3 (rotX, rotY, rotZ) like in "normal 3D programs". I hope you understand me. Thanks.
L.
User avatar
ladty
 
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Re: Orientation in m3g

Postby DevelopmentTeam » Fri Jul 25, 2008 5:05 am

Hi Ladty,
Setorientation is bit confusing yes. But once you get use of it, it is really helpful.
Code: Select all
//Rotate an object 45 degrees along X axis
object.setOrientation(45.0f, 1.0f, 0.0f, 0.0f);

//Rotate an object 45 degrees along Y axis
object.setOrientation(45.0f, 0.0f, 1.0f, 0.0f);

//Rotate an object 45 degrees along Z axis
object.setOrientation(45.0f, 0.0f, 0.0f, 1.0f);

//Rotate an object 45 degrees along X, Y and Z axes
object.setOrientation(45.0f, 1.0f, 1.0f, 1.0f);
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Orientation in m3g

Postby ladty » Sat Jul 26, 2008 10:19 pm

Thanks for reply, but what should I do, when I want to rotate somethink for example 30° around X, 67° around Y and 27° around Z axis? (or other angles, do you have any function to convert this to "setOrientation"?)
L.
User avatar
ladty
 
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Re: Orientation in m3g

Postby DevelopmentTeam » Sun Jul 27, 2008 9:55 am

Code: Select all
//Rotate an object 30 degrees along X axis
object.setOrientation(30.0f, 1.0f, 0.0f, 0.0f);

//Rotate an object 67 degrees along Y axis
object.setOrientation(67.0f, 0.0f, 1.0f, 0.0f);

//Rotate an object 27 degrees along Z axis
object.setOrientation(27.0f, 0.0f, 0.0f, 1.0f);


You can use these 3 lines to rotate as you asked. This cannot be done in a single function, but you have to do it in 3 lines like this.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Orientation in m3g

Postby ladty » Mon Jul 28, 2008 2:06 pm

Too bad :-(
Btw I think you ment
Code: Select all
object.setOrientation(30.0f, 1.0f, 0.0f, 0.0f);
object.preRotate(67.0f, 0.0f, 1.0f, 0.0f);
object.preRotate(27.0f, 0.0f, 0.0f, 1.0f);

or somethink like that (setOrientation "sets" the orientation, so in your case it would probably have just 27° rotation around Z axis (so rotation would be [0,0,27] instead of [30,67,27]))
But thanks for your help :wink:
User avatar
ladty
 
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Re: Orientation in m3g

Postby DevelopmentTeam » Tue Jul 29, 2008 4:35 am

Ah, sorry. Yes it is prerotate and in runtime we are using post rotate for some reason. I dont remember why we chose post rotate. Anyway sorry for the confusion. ;|
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to 3D Mobile Game (M3G)

Who is online

Users browsing this forum: No registered users and 2 guests

cron