sbPhysics - the Shiva Bullet plugin - Now with more Meat!

Error message

Warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 340 of /home/digital1/public_html/synapticbytes/includes/unicode.inc).

Well, my work continues on writing a Bullet Physics plugin for Shiva.

I've decided I'll start creating blog entries for the updates, instead of a static page as I have done in the past to track my progress. I must say, there sure is a lot of head scratching as I try to remember my High School maths - calcular, vectors and matrices, mechanics and forces, and then throw in complex maths and quaternions, and it sure makes the head spin.

This version is 0.1.3. I've remade the file to give it a new name "sbPhysics", which now matches the APi name as well, and added a whole swag of functionality from the last version, including Cylinder, Capsule, Cone, Static Plane and Convex Hull rigid body shapes. I haven't had a chance to test Capsule, Static Plane or Convex Hull yet. Convex Hull in particular could be a minefield. There are also calls in for Triangle and Box2D shapes, but they are not yet implemented.  Note currently you'll have to pass in the size parameters for your rigid bodies, as I'm yet to figure out how to correctly find the appropriate "size" of a Shiva object to allow automatic body creation. NiCoX has given me a hint on the Shiva forums, but that's more of that maths which makes my head hurt, so I'm procrastinating on that one.

Also included are some starter constraints, Pivot, Hinge, Slider and ConeTwist, of which only Pivot is implemented so far. There's a couple more to go in, but I'll get this lot working first before I add Hinge2, Generic 6DoF and I'll try and implement Universal Joint as well.

Finally, there's some additional functions for operating on rigid bodies, such as adding impulse, force, torque, body damping etc, but none of these have been tested yet either, so caveat emptor. I'm working on getting the functionality in and at least semi-functional, but have yet to go back and put in complete validation and error checking, so if you throw strange values at the functions, you may get back strange results, or even the mysterious "AI error" with no further information.

Having said that, if you run the demo, I think you'll see there's quite a bit going on now, so it's getting to at least a usable state for basic dynamics using Bullet. There is something funky happening at the pivot I've got in the demo scene, where it's colliding with the arm it's attached to in strange places above the arm. When I split the pieces out separately, they all look fine, so I'm thinking something's happening with collision margins, but it could be anything. If you have an idea, I'd be pleased to hear it.

I'll try and have a new version each week, although sometimes I might skip a week as family comes first. My weekly task for this week is something like :-

  1. Check & get working Capsules and Complex Hulls
  2. Check & get working Hinge & Slider constraints
  3. Check & get working Impulse, Force & Torque inputs
  4. Add automatic body sizing to match Shiva object in rigid body creation

So that's about it for this week. The link to this version is below. I'm setting the demo's to expire every second month, so we don't have people trying to use old dodgy code. if you have any comments or questions, please post them on the Shiva Plugins forum for now. I'll get around to comments here when i can figure a safe way to get them up.

Download the demo code and plugin here : sbPhysics Demo v0.1.3