Archived

This topic is now archived and is closed to further replies.

Dr Pain

Face world coordinates

Recommended Posts

I''ve got a "Plane" object defined as part of a 3DSMax file. I need to get the world coordinates of its four vertices in my program. How do I do this? I''ve got the object''s name, and I can get the correct segment. Here''s what I''ve deduced (probably incorrectly) so far: segment->pos_keys->pos_info is the center point of the face, but if I rotate the face in MAX, I seem to get the center point of a large bounding box for the face. rot_keys.rot_info.vector is a vector pointing in the direction of the face (just a guess here). localtoworld[0] = cos(theta) localtoworld[1] = sin(theta) vertex_list.x = width vertex_list.z = height Is any of this correct? I''d suggest instead of more "tutorials", you spend time commenting your headers. Thanks, Dave

Share this post


Link to post
Share on other sites
pos_keys and rot_keys are used for keyframing. You need to do this (mostly taken from collide example)

/* Disable culling */
for (segnum = 0; segnum < shape->num_segments; segnum++)
shape->segment_list[segnum].flags |= FLAG_ALWAYS_VISIBLE;

/* Reset camera matrix to identity so object isn''t projected */
PR_MatrixIdentity (PR_Globals.PR_ViewMatrix);
PR_TransformEntity (entity);

/* If you want to render this later, enable culling */
for (segnum = 0; segnum < shape->num_segments; segnum++)
shape->segment_list[segnum].flags &= ~FLAG_ALWAYS_VISIBLE;

Now get the transformed vertices from seg->vertex_data[vertnum]
in the vx,vy,vz fields. Make sure you have the D3D pipeline off before you transform.





Author of Power Render (http:/www.powerrender.com)

Share this post


Link to post
Share on other sites