1) Static Box vs Dynamic Sphere -> Collision OK
2) Scaled Static Box vs Dynamic Sphere -> No collision at all. They do not sense each other.
Code: Select all
void SetScale(D3DXVECTOR3 &v)
{
_pPhyObj->m_worldTransform.scale(*(btVector3*)&v);
}
Code: Select all
void SetScale(D3DXVECTOR3 &v)
{
_pPhyObj->m_worldTransform.scale(*(btVector3*)&v);
}
You should set the scaling on the btCollisionShape. Please do so before you calculate the inertia tensor, and preferably before you add it to the world.Jack wrote:Situation:
1) Static Box vs Dynamic Sphere -> Collision OK
2) Scaled Static Box vs Dynamic Sphere -> No collision at all. They do not sense each other.
What can be wrong?Code: Select all
void SetScale(D3DXVECTOR3 &v) { _pPhyObj->m_worldTransform.scale(*(btVector3*)&v); }
That worked. But:Erwin Coumans wrote:You should set the scaling on the btCollisionShape. Please do so before you calculate the inertia tensor, and preferably before you add it to the world.Jack wrote:Situation:
1) Static Box vs Dynamic Sphere -> Collision OK
2) Scaled Static Box vs Dynamic Sphere -> No collision at all. They do not sense each other.
What can be wrong?Code: Select all
void SetScale(D3DXVECTOR3 &v) { _pPhyObj->m_worldTransform.scale(*(btVector3*)&v); }
I will remove the scaling on the worldtransform, we are only dealing with rigid transforms in Bullet (the scaling method on btTransform it is an obsolete remainder).
Thanks for pointing this out,
Erwin
You have to apply the scaling yourself on the graphics object, the world transform doesn't contain the scaling.Jack wrote: That worked. But:
1) getOpenGLMatrix does not include scaling in the returned matrix. Do you think it is right?
2) As I understood I can not change scale dynamicaly. Right? Then it is going to be useless feature, I think...
Do not you think these steps should be done automaticaly by Bullet? Do not you think that Inertia Tensor to be managed entirely By Bullet? Probably there could be method GetInertiaTensor (if user wants to know it), but such methods as calculateLocalInertia, updateInertiaTensor, setMassProps look redundant.Erwin Coumans wrote:You have to apply the scaling yourself on the graphics object, the world transform doesn't contain the scaling.Jack wrote: That worked. But:
1) getOpenGLMatrix does not include scaling in the returned matrix. Do you think it is right?
2) As I understood I can not change scale dynamicaly. Right? Then it is going to be useless feature, I think...
You can dynamically scale rigid bodies, as long as you make sure to call a method to update the inertial tensor. WARNING: not all shapes might support the re-scaling yet, especially static triangle meshes that use a bounding volume hierarchy need to rebuild this hierarchy probably.
1) update the scaling on the btCollisionShape derived class
2) calculate new localinertia on that collision shape
3) call the setMassProps(mass,updatedLocalInertia) on btRigidBody
4) call the updateInertiaTensor on the btRigidBody
If you are rescaling a dynamic rigidbody make also sure to activate it, and don't cause too deep penetration in one timestep.
Hope this helps,
Erwin
No, I don't want to force users to use Bullet's inertial tensor calculation. You can optionally use it, but also load it from file (COLLADA physics provides the inertia tensor that it gets from the tool (Maya, Max, XSI, Blender etc)) or calculate it yourself.Jack wrote: Do not you think these steps should be done automaticaly by Bullet? Do not you think that Inertia Tensor to be managed entirely By Bullet? Probably there could be method GetInertiaTensor (if user wants to know it), but such methods as calculateLocalInertia, updateInertiaTensor, setMassProps look redundant.
When you create the shape you pass body density. Then Volume, Mass, Inertia are managed automaticaly. User can get these values, but not set...
So, is a btTransform only for rotations and translations?Erwin Coumans wrote:I will remove the scaling on the worldtransform, we are only dealing with rigid transforms in Bullet (the scaling method on btTransform it is an obsolete remainder).
Code: Select all
myBtTransform . getBasis ( ) . scaled ( myBtVector ) ;