AC3D Forums Get Rotation of a Group or Object
 Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 12th June 2006, 09:42 PM #1 conzar Member Advanced member     Join Date: May 2006 Posts: 36 Get Rotation of a Group or Object Is it possible to get the rotation of an object relative to the origin? Simular to the get_centre function. For example, say you have 2 boxes in a group. You rotate that group on the x-axis by pi. Is there a way that I can get the rotation about the x,y,z axis? So for the example here I should get rotation (3.14,0,0). If we rotate the group again in the same direction on the same axis by pi again, then we should get [0,0,0].
 13th June 2006, 04:05 AM #2 Andy Administrator Professional user     Join Date: Jun 2003 Posts: 4,450 Re: Get Rotation of a Group or Object Sorry, this is not currently possible since the vertices are rotated in the global space.
 13th June 2006, 08:35 PM #3 conzar Member Advanced member     Join Date: May 2006 Posts: 36 Re: Get Rotation of a Group or Object Ok, I think its possible to do this ... check my math and let me know what u think. Have a group that is to be copied. The copies of the group are to be translated and rotated. I think it is possible to get the rotation of the groups by doing the following: * translating the copy back to the origin (where the location of the original is) * calculate the rotation of the x,y,z axis via the location of vertaces. -> ie, take the first vertex from the copy and the first vertex from the original and apply the math below The above math is derived from the information found at the link below. http://www.tpub.com/math2/5.htm So what do you think? Does this sound feasible? I need functions that do the followingtranslate group to origin Get a specific vertex in a group (the first one) arc tan function I know there are functions available in the ac3d headers that do the first 2. So can I use the Math.h functions to get arc tan or is there something available in the headers for that? (Update) I've answered my own question here - I just tried atan and Math.h works! Last edited by conzar; 13th June 2006 at 08:55 PM.
 21st June 2006, 11:11 PM #4 conzar Member Advanced member     Join Date: May 2006 Posts: 36 Re: Get Rotation of a Group or Object Arg. Looks like the math above is flawed b/c one doesn't know in which order the object was rotated. So I have come up w/ another possible solution. Here it is: Create a plugin that records the rotations applied to an object as well as which order the rotations were applied. I think this is a simple solution; none-the-less, its a solution. I'll report back in a few days ...
 25th June 2006, 04:19 PM #5 conzar Member Advanced member     Join Date: May 2006 Posts: 36 Re: Get Rotation of a Group or Object Hey. So I can't seem to find a function call to rotate an object. The only functions I found that seemed close are listed below. Code: ```set_global_matrix_rotate(float rx, float ry, float rz) void rotate_object(ACObject *ob)``` What I would like to have is something like Code: `ac_rotate_object(ACObject *ob, float rx, float ry, float rz)` Is there anything like that? Thanks
 7th September 2006, 06:45 AM #6 PerFnurt Member Expert member   Join Date: Aug 2003 Location: Eslöv, Sweden Posts: 93 Re: Get Rotation of a Group or Object Can't you use the 2 function calls in the way you're requesting? void my_rotate_object(ACObject *ob, float rx, float ry, float rz) { set_global_matrix_rotate(rx,ry,rz); rotate_object(ob); recordRotationSomehow(rx,ry,rz); } __________________ /Per www.perfnurt.se Last edited by PerFnurt; 7th September 2006 at 10:24 AM.

 Thread Tools Display Modes Hybrid Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

All times are GMT -4. The time now is 10:30 PM.

 Archive - Top

AC3D Forum
(C) Inivis Limited 2020