Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What are the "smallest" physics components in your component-based game engine?

Would it make sense to create something like Positionable, Rotatable, Movable, Collidable and combine them the way you want or is it better to use one unified component like PhysicsInteractable?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Well, it depends of the overall look of your engine. I have always aimed for static and dynamic objects; the static ones just sit there with their collision data and the dynamic ones get updated and checked against static and other dynamic objects.

share|improve this answer
    
This makes sense. Would like to hear more opinions though. –  Den Oct 28 '10 at 12:42
    
I agree with this. You should split the objects into two categories, the actually movable ones, and ones invisibly anchored to the environment, so they affect other objects, but don't move. –  Tesserex Oct 28 '10 at 13:13
    
What about (sub)systems? Should there be two separate systems: one for moving and another for collisions? –  Den Oct 28 '10 at 13:25
    
By doing two systems, you would have to iterate through all your objects twice; one for updating the position, velocity... and other for checking if it collided with something. Just do everything in the same loop: update the properties and check if it intersects something, and then apply bounce/deceleration/etc. –  r2d2rigo Oct 28 '10 at 13:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.