Erwin Coumans wrote:Without a sample file that is difficult to determine. Do you have a modified Bullet demo that shows similar behaviour?
No. Demos from the "bullet-1.9\msvc\8" folder work OK.
Erwin Coumans wrote:Many things can be wrong. What is gravity? How large are the objects? What is the collision margin? Do you initialize the inertia tensor? What is the timestep?
1) gravity = 9.8
2) BoxShape object (half size = 25), ConvexTriangleMeshShape approx. the size of the box object.
3) margin? what is it? I do not set it in my program...
4) inertia tensor comes from CalculateLocalInertia
5) timestep is constant = 1/60. By the way if I set variable timestep, ojects do not move at all (they freeze in the space)
Here is some fragments of my code:
PHYSICS::PHYSICS()
{
SimdVector3 worldAabbMin(-30000,-30000,-30000);
SimdVector3 worldAabbMax(30000,30000,30000);
_pDispatcher = new CollisionDispatcher;
_pBroadPhase = new AxisSweep3(worldAabbMin, worldAabbMax, 32766, 65535);
_pPhysEnv = new CcdPhysicsEnvironment(_pDispatcher, _pBroadPhase);
}
void ATOM::Initialize(SHAPE *const pShape, RENDER::ATOM *const pRenderAtom, bool bStatic)
{
assert(pShape);
assert(pRenderAtom);
_pRenderAtom = pRenderAtom;
_ci.m_MotionState = this;
_ci.m_collisionShape = pShape->m_pCollisionShape;
if(bStatic)
{
_ci.m_collisionFlags = CollisionObject::isStatic;
_ci.m_mass = 0;
_ci.m_collisionFilterGroup = CcdConstructionInfo::StaticFilter;
_ci.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter;
}
else
{
SimdVector3 LocalIn;
pShape->m_pCollisionShape->CalculateLocalInertia(1, LocalIn);
_ci.m_localInertiaTensor = LocalIn;
_ci.m_mass = 1;
_ci.m_gravity = SimdVector3(0, -9.8f, 0);
_ci.m_collisionFlags = 0;
}
_pPhyCtrl = new CcdPhysicsController(_ci);
}
void STATIC_PLANE_SHAPE::Initialize(const __m128 &vNormal)
{
m_pCollisionShape = new StaticPlaneShape(*(SimdVector3*)&vNormal, vNormal.m128_f32[3]);
}
void BOX_SHAPE::Initialize(const __m128 &vHalfSize)
{
m_pCollisionShape = new BoxShape(*(SimdVector3*)&vHalfSize);
}
Erwin Coumans wrote:Also, the continuous collision detection (CCD) is not enabled by default, which means there is no safety for fast moving objects (moving faster then their own size in one timestep). This CCD is work in progress, and should prevent objects going though eachother.
Objects fall from height = 100, 150 and 225 (starting speed=0). Their speeds at the surface are small. Sometimes objects do not fall thru the surface plane. They can lie on the surface but approx. 50% of the object is under the surface.
How to enable CCD?
Also sometimes
assert(proxy0 != proxy1);
from the
OverlappingPairCache::AddOverlappingPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1)
occurs