Game engine design help!

Started by
9 comments, last by Stani R 13 years, 8 months ago
Quote:Original post by BkoChan
What happens when an actor contains another actor though. ie. My player actor is carrying a barrel actor.

I get that I can rotate and transform to draw the player, then again to draw the barrel but how then do I know where the barrels bounding box is since I now have no global position for the barrel?


Then you'll have to concatenate the actor's transformation with the parent actor's transformation. At this point OpenGL can no longer help you and you have to build the ModelView matrix yourself and set it in OpenGL. This is where a scene graph becomes useful to some extent, because you can walk down the graph and update the actor's local and world transforms (and local/world positions/orientations if you want) as you go. Then when it comes time to render you can combine the camera transform with the world transform of the actor you are rendering.

Personally I just try to avoid the "actor is child of another actor" scenario altogether and make all actors "top-level". You can express the relationships between actors in terms of physics constraints. I don't have many shipped games to back up my philosophy, however :)

This topic is closed to new replies.

Advertisement