Jump to content
  • Advertisement


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


Moving models the right way

This topic is 5584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, This is my first post here. I''ve tried googling for the best way to do this, but ideas seem to differ a bit so I thought I''d post here. After all, this must be a common thing. I''m considering how best to move 3d models (loaded into vertex lists) around. When I load them in, the model''s vertices are in world space, and that is difficult to deal with when updating every frame. Naturally, I thought it would be best to define a "centerpoint" for each model, and redefine all the vertices from that point (an object space of sorts). Then each frame, you just move the centerpoint and all the vertices would hopefully follow by some magical mean. I''m just wondering if someone knows of a good resource for this. I''m thinking the best way must be to export the 3d model centered to world space in the 3d program (that way all vertices would be centered in the coordinate system and you''d have a natural center point). But how do you then move each object around in the rendering loop? Since I''d only move the origin for the model, I''d have to translate to the origin for each object, then untranslate and translate again for the next and so on. Is this the best way to do it? One further question: If I have such a structure, that each object''s vertices is defined in "object space" around a center point, how do I then get it to world space again for the lighting calculations? I''m using openGL, but I thought this is more general programming. I would appreciate any pointers to articles dealing with this (a simple implementation would be great for learning). I''m pretty new to this

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I don''t use OpenGL so I can''t give you the appropriate code, but you''re on the right track.

You can move a model into world space with a "World Transformation Matrix". OpenGL and DirectX both know that this transform must occur before lighting can be calculated, so that''s not an issue.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!