How do 3D engines deal with objects/ entities (i.e. monsters, crates, etc.)? Since objects/entities need to maintain their own origins (is this right?) for rotations and animations, does this mean that each objcet/entity will have to have its own transformation matrix associated with it? And if so, what type of data structure would you suggest using to store this information? I hope I'm not way off base with this question. I am fairly new to all of this and am just trying to grasp some of the concepts.
Yeah. In general, you center the object on the origin (so for example a pyramid would have vertices at <1,0,1>, <-1,0,1>, <1,0,-1, -1,0,-1>, <0,1,0>). These are said to be in "model coordinates". You then need some information to describe this object's position and orientation in "world coordinates". For an object that doesn't move with respect to the 3d world, you could save this information in a D3DMATRIX. For one that does move, you could save this information in two D3DVECTORS Pos and Orient. Pos is the position and Orient is the orientation (the x,y,z components of Orient would actually be the heading, pitch, and roll). There are probably a ton of other ways to save this information--I find this way easier to manipulate the moving objects. Anyway with the D3DVECTORS, for each frame you'd compute a D3DMATRIX M corresponding to them and, right before you render the object, do a SetTransform(D3DTRANSFORMSTATE_WORLD, &M);. There are quite a few optimizations you can add to this, but this is the basic idea. Hope this helps. There are quite a few good tutorials and docs on this stuff, off the top of my head do a search for Pipeline in the DirectX SDK docs. I'm assuming you're looking at Direct3D but the same concepts hold true for other 3d systems. Just in case you're not using Direct3D, a D3DMATRIX is a 4x4 matrix and a D3DVECTOR has 3 floats, x y and z. -ns