View Single Post
Old 26th September 2006, 09:38 PM   #9
Dennis
Senior Member
Professional user
 
Dennis's Avatar
 
Join Date: Jul 2003
Posts: 899
Default Re: Get Rotation of a Group or Object

Quote:
Originally Posted by conzar View Post
Humm. Seems like the above code rotates an object about the origin. How would I rotate it about the center of the object? I would like the same functionality as the rotate buttons on the left side bar.
You'll want to move the object to the origin, rotate it, then move it back to its original position. The rotation function exposed through the SDK doesn't handle the translation part of the equation.

Alternatively, you could call the code that AC3D uses when you use the left side bar rotate function. Check out the ac3d.tcl file in the "scripts" directory and look for "ac3d rotate_axis_angle". This snippet might help:

Code:
// Specify axis where 0 = x, 1 = y, 2 = z
int axis = 1;
float degrees = 90.0f;
tcl_command( "ac3d rotate_axis_angle %d %g", axis, degrees );
The above code should rotate the selected geometry 90 degrees around the Y axis, relative to the object/selection center. Note that this is off the cuff and untested.

Good luck
Dennis is offline   Reply With Quote