Open Ithamar opened 8 years ago
Vehicle class, which is a subclass of the bullet::Collider class (since a Vehicle chassis is basically a "normal" Bullet RigidBody with some very special constraints).
I think you should avoid inheritance. Maybe your Vehicle class component should create and add a Collider component instead of extending it.
The Vehicle class has methods to connect the wheels (VehicleWheel class, another bullet::Collider subclass), allowing to specify the per-wheel tuning parameters.
Because of this implementation of the comment above, you'll end up with a design issue I've yet to come around: dependency injection. This setup works as long as you're not trying to clone the subtree to instanciate multiple vehicles. We have an existing - but very unsatisfying - way to handle this scenario and you'll have to use it.
But I'm totally open to suggestions regarding how to "reconnect" components/nodes after a clone. This might be interesting: http://blog.leapmotion.com/hello-world-meet-autowiring-c/
The one feature I'm missing in Minko that makes it less attractive for my current projects is vehicle support. Since we already have a physics plugin using Bullet, exposing the Bullet vehicle support should not be too much work.
I'm experimenting with an implementation at the moment, but not sure how to fit it into the current bullet plugin. My current setup is like this:
Vehicle class, which is a subclass of the bullet::Collider class (since a Vehicle chassis is basically a "normal" Bullet RigidBody with some very special constraints).
The Vehicle class has methods to connect the wheels (VehicleWheel class, another bullet::Collider subclass), allowing to specify the per-wheel tuning parameters.
Once this is done, the Vehicle class can be used to setSteeringValue() and/or applyEngineForce() and such.
The above is almost working ( :smile: ) but before I start cleaning up and posting a pull request, is this an acceptable design, does anyone see problems with this, and especially, @promethe42 , do think this design could work with the Blender plugin in future integrations?