开发者

Move a 3D custom geometry: the best way to do it

I'm building with XNA a class that encapsulate a custom geometry defined in a arbitrary way. I want to this geometry moves, now, what is the best way to do it? Is it enough bring all coordinates vertices and multiply them with the translate matrix using Vector3.Translate method? Or 开发者_如何学Pythonis it more efficient assign a geometry to an Effect (say BasicEffect) and then manipulate the world matrix?

Thanks!


I'm not that deep into xna right now, but speaking of 3D programming in general you should transform the world matrix to "move" the object's origin. This will be a lot faster than updating all vertices to their new coordinates (a LOT faster as the calculation can be offloaded to the graphics card). You should never modify/update geometry data just to move stuff around. This might be okay for complex animations, but (in my opinion) not for single translations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜