When exposing the btRigidBody class to 3D modelling software, what should the modeller be able to set?
I looked at the source code and my candidates are:
mass,
local inertia,
angular damping,
linear damping,
angular sleeping threshold,
linear sleeping threshold,
friction,
restitution;
though it looked like some of them are set to a hard value upon initialization in the constructors.
Maybe some of you can help me, can any of those variables be omitted safely (seen some implementations and they use 3-4 variables often)?
What would be sensible standard and minimum and maximum settings (so bad settings don't "break" the simulation) for the remaining values?
Thank you for any constructive input in advance.
btRigidBody -> 3D modeller, needed variables?
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: btRigidBody -> 3D modeller, needed variables?
That is exactly the set of things I read from my collision mesh files, except that I also give the collision margin for each primitive or hull that comprises the collision object.
I actually never bothered implementing intertia though, bullet often just uses a bounding box approximation of intertia anyway.
As you point out, much of the time only some of these values need to be specified, because the defaults are good enough.
I have used all of them in some cases though.
As for maximum ranges, I wouldn't bother. Obviously a negative mass and intertia component is a bad idea so they should be [0,...]. Friction, restitution and damping should be between [0,1] and the sleep thresholds should be [0,...] too.
I actually never bothered implementing intertia though, bullet often just uses a bounding box approximation of intertia anyway.
As you point out, much of the time only some of these values need to be specified, because the defaults are good enough.
I have used all of them in some cases though.
As for maximum ranges, I wouldn't bother. Obviously a negative mass and intertia component is a bad idea so they should be [0,...]. Friction, restitution and damping should be between [0,1] and the sleep thresholds should be [0,...] too.
-
- Posts: 4
- Joined: Wed Aug 27, 2008 10:24 pm
Re: btRigidBody -> 3D modeller, needed variables?
Thank you sparktime.
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: btRigidBody -> 3D modeller, needed variables?
If you're doing a gui, you can have a checkbox for "static", that will zero the mass and inertia. Then you can disallow the explicit entry of 0. I think a 0 inertia might cause problems if the mass is non-zero but I'm not really sure. It might just behave as if the inertia was infinite which could have some useful applications, e.g. objects that move around but don't rotate. I'll try it out when I get a minute.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btRigidBody -> 3D modeller, needed variables?
Is this GUI an artist tool that should be user-friendly, or for advanced users who know about the underlying physics functionality?
Erwin
- It is best to allow to enter mass = 0 for static/non-moving objects, which is Bullet convention (Havok uses the same in its tools). It is best not to expose the inertia tensor to GUI.
- Just let Bullet calculate the local inertia tensor internally: for non-zero mass objects use shape->calculateLocalInertia(mass,inertia), otherwise use zero vector. Using a zero inertia vector for non-zero mass is nonsense.
- Unless you have 'advanced settings', I would not expose angular sleeping threshold or linear sleeping threshold or collision margin.
- collision shape type: convex primitives, convex hull, plane (force mass = zero), concave triangle mesh, compound shapes.
- Make sure to use btBvhTriangleMeshShape for static/non-moving concave meshes with mass zero, and btGImpactMeshShape for moving (non-zero mass) concave triangle meshes.
- Make sure to 'bake' non-uniform local scaling into the collision shape (use setLocalScaling)
- Friction can be larger than 1, so range is [0..INF] instead of [0..1]
- Bullet 2.71 will ship with a new Maya Plugin, contributed by Walt Disney Studios.
- Check the free Havok tools documentation for Max, Maya, XSI.
- Blender-Bullet integration, see some old docs in the wiki.
- Read the open COLLADA specification, it includes data representation on rigid bodies. Bullet has built-in support to load/save to this XML based format.
Erwin