Skip to main content
gamedev.net
🔒 Locked

Face world coordinates

Started by Dr Pain Oct 21, 2001 at 2:46 PM 0 replies 400+ views
Original Post
Dr Pain
Dr Pain
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
ChrisE
ChrisE
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)
Author of Power Render (http:/www.powerrender.com)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.