PDA

View Full Version : Calculating Offsets from Selection Center to Pivot Point Center


lehthanis
02-02-2008, 08:42 PM
One of the challenges of thsi exporter I'm building is that it exports multiple objects to a single object file, and uses these attributes and mesh commands that I've been struggling with to specify moving parts and surface properties etc...

For example, a flight stick in a cockpit to the sim object is just a collection of triangles that are part of the object. The object has one origin and thats always 0,0,0 no matter what the width, height, or length of the object or how it relates to 0,0,0...If I want to make that flight stick rotate along its base, I have to specify an offset from its center mass that points to the pivot point.

So what I need to calculate is the X, Y, and Z offset from what 3ds considers the selection center of the object to the actual pivot point. Screenshots included. First shows the pivot, second shows the selection center...thats what I need to calculate the distance between. I have the object as a SnapshotAsMesh

PiXeL_MoNKeY
02-02-2008, 09:59 PM
You should be able to use something like:
offset = obj.pivot - obj.center

-Eric

lehthanis
02-03-2008, 12:28 AM
Actually I was wrong about a couple of things here...First of all, its not the distance from the center...its the distance from 0,0,0 which is very easy to acquire. .pos

BUT...because I'm doing an arbitrary rotation of all objects around 0,0,0 I'm going to need another way to specify the pivot point for the animation modifier.

I figured, since I'm using a simplemod to specify the animation parameters I can use the simplemod's Center subobject to represent the pivot point...but I don't know how to access it.

CGTalk Moderation
02-03-2008, 12:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.