There are some inconsistencies with btStaticPlaneShape. The parameters are a normal and some constant where the constant determines the distance of the plane to the origin. If this is sufficient to define a plane, there's a bug in Bullet, as you must also define a transformation (with identity matrix and a zero vector) to make the plane work.
Noehrgel
btStaticPlaneShape inconsistencies?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btStaticPlaneShape inconsistencies?
All shapes are defined in their local coordinate frame. For example, a box is just defined by its halfExtents in 3 directions. A sphere is just defined by radius, and a plane by this plane equation (normal, plane constant).Noehrgel wrote:There are some inconsistencies with btStaticPlaneShape. The parameters are a normal and some constant where the constant determines the distance of the plane to the origin. If this is sufficient to define a plane, there's a bug in Bullet, as you must also define a transformation (with identity matrix and a zero vector) to make the plane work.
Noehrgel
All shapes are positioned in the world by adding them to a collision object (or rigidbody), which has the world transform.
See CcdPhysicsDemo, search for USE_GROUND_PLANE. The transform that belongs to this ground shape is 0,-30,0, with no rotation, See line 359. You can add some rotation too, for example:
Code: Select all
trans.setOrigin(btVector3(0,-30,0));
trans.setRotation(btQuaternion(btVector3(1,0,0),0.25*SIMD_HALF_PI));
Erwin
PS: there is one more optional transform that you can apply to shapes, to re-position the shape relative to the center of mass (world transform). Just a btCompoundSHape for this, and add a child-shape+transform.
-
- Posts: 10
- Joined: Mon Aug 21, 2006 5:11 am
Re: btStaticPlaneShape inconsistencies?
It explains your design and that is perfectly okay for me, but there is this trap. One could take this as a philosophical question I think: shouldn't btCollisionShape be an empty container, as a plane has no such parameters like a sphere or box (specifying extent but not transformation)? Well, I'm splitting hairs ...Erwin Coumans wrote:[...]
Hope this helps?
I'm not sure whether I understood this. Isn't this something like a Composite-Pattern? All transformations applied to a btCompoundShape are applied to its children. If I apply a transformation to a child this transformation is defined in the local coordinate system of that compound shape?PS: there is one more optional transform that you can apply to shapes, to re-position the shape relative to the center of mass (world transform). Just a btCompoundSHape for this, and add a child-shape+transform.
PS: I don't mean to offend anyone. If it sounds like this than it's due to my bad english (this applies to anything I say, except I state something different explicitly)
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btStaticPlaneShape inconsistencies?
You are right, but I prefer a general 'unified' solution. I didn't want to break this for the plane shape. Same for static triangle meshes, they all fit in the same framework. We could 'assume' that triangles are always in worldspace (as you suggest for the plane) but the convention is that shapes are defined in their local space.Noehrgel wrote:It explains your design and that is perfectly okay for me, but there is this trap. One could take this as a philosophical question I think: shouldn't btCollisionShape be an empty container, as a plane has no such parameters like a sphere or box (specifying extent but not transformation)? Well, I'm splitting hairs ...Erwin Coumans wrote:[...]
Hope this helps?
Bullet implements the full COLLADA Physics specification, see http://www.khronos.org/collada/I'm not sure whether I understood this. Isn't this something like a Composite-Pattern? All transformations applied to a btCompoundShape are applied to its children. If I apply a transformation to a child this transformation is defined in the local coordinate system of that compound shape?PS: there is one more optional transform that you can apply to shapes, to re-position the shape relative to the center of mass (world transform). Just a btCompoundSHape for this, and add a child-shape+transform.
You can use Bullet's compound shapes to add additional shapes each with its own rotation/translation. Check out the CcdPhysicsDemo, search for 'bool useCompound' and make it true to see them in action.COLLADA Specification 1.41 wrote: Rigid-bodies may contain a single shape or a collection of shapes for collision detection. Each shape may
be rotated and/or translated to allow for building complex collision shapes.