setCcdMotionThreshold not working, still able to "push" thru

User avatar
squisher
Posts: 11
Joined: Wed Jul 30, 2008 6:08 pm

setCcdMotionThreshold not working, still able to "push" thru

Post by squisher »

Hi,

I'm unable to get the ccdMotionThreshold feature added in 2.72 to make any noticable difference.. what am I doing wrong?

I control my character (a btRigidBody) by applying a force (applyCentralForce) before each call to stepSimulation(deltaTime * 0.001f, 60).

I apply a force to my character such that he's attempting to go through a wall (a btBvhTriangleMeshShape with 0 mass), the character can push through. Here's some misc. info, if it helps:
  • character's mass: 5.0
    global gravity: 0
    character size: aabb min: -6, -2, -5 aabb max: 6, 2, 2
    force applied per step: 10000.0
    character max velocity: 300.0 (enforced every call to InternalTickCallback)
    size/shape of the wall: about 50 times the size of the ship, and just as thick
    character shape: btConvexTriangleMeshShape
The issue doesnt seem to happen only when I'm "pushing"... if I just hurl myself at full velocity sometimes I'll punch through the wall as well.

Im currently using a ccdSweptSphereRadius of 2.0, but I've tried many values from 0.001 to 100...
Also im using a ccdMotionThreshold of 30, although ive tried values between 0.1 and 300.

Nothing seems to work. Is there a flag I'm supposed to set? Any help would be greatly appreciated.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: setCcdMotionThreshold not working, still able to "push" thru

Post by Erwin Coumans »

The ccd motion clamping is currently not enabled when objects are already in contact.

We will improve the Kinematic character controller so that tunneling won't happen (see Demos\CharacterDemo\KinematicCharacterController)

Hope this helps,
Erwin
User avatar
squisher
Posts: 11
Joined: Wed Jul 30, 2008 6:08 pm

Re: setCcdMotionThreshold not working, still able to "push" thru

Post by squisher »

Hi Erwin,

Thanks for the reply. The code for the KinematicCharacterController demo is quite scary :oops: I wound up taking the lazy man's approach, changing the fixedTimeStep of my world from the default 1/60 to 1/180 and it now works like a charm! (No real decrease in performance either)