dmah42 / dart-box2d

Box2D for Dart
http://dart-lang.github.io/dart-box2d/
34 stars 5 forks source link

Body subclasses need to be built by World #8

Closed dmah42 closed 11 years ago

dmah42 commented 11 years ago

There is currently no way to change the behaviour of Body. E.g. say one wanted to make a Body that takes some action when it is put to sleep. Rather than implementing extra events, a better solution is to have bodies that wish to react to this be custom subclasses of Body with extra logic.

laszlokorte commented 11 years ago

Is there a reason why you can not create the body by yourself and ADD it to the world instead of using a factory method provided world? (same for joints).

dmah42 commented 11 years ago

That would be cleaner - I already have a TODO for the joints to clean up the Joint.create method to use type information, but it would be even simpler to remove that altogether and just have add/remove methods in World for joints and bodies.