Using CCD and Kinematics Objects question

Nsoft
Posts: 2
Joined: Fri Jul 19, 2013 7:00 pm

Using CCD and Kinematics Objects question

Post by Nsoft »

Hi to all

I'm using right now bullet 2.81 inside a complex simulation engine as collisions detection system. In effect, I use bullet for collisions detection only: I have kinematics objects only which I move under my geometricals and physicals laws and I leave to bullet the collisions detection works. I have a btDynamicWorld which I add all my simulation objects as rigidBody and, at any simulation step, I update the rigidBody objects accordingly with my simulation movements. This works fine, I'm able to get collisions from bullet Manifold and I can propagate them in my applications.

Now, I have to move a projectile which has a start velocity of 2500m/s. Obviously, a "standard" collision detection system is not sufficient: I get the 25% of totals collisions because the object is too mush fast and tiny (the projectile make 1000 m/s for a dimension of 0.5x0.5x0.5m). So, I have tried the CCD collision system: I have set the main projectile properties and I continue to move this projectile inside my simulation engine as kinematic object, setting up the projectile btRigidBody position inside btDynamicWorld at any simulation step. The setup is like this:

btVector3 m_init_velocity = btVector3(getDir()*2500); //getDir() is the initial versor direction of projectile muzzle.
m_MyPhyModel->setLinearFactor(btVector3(1,1,1));
m_MyPhyModel->setLinearVelocity(m_init_velocity);
m_MyPhyModel->setAngularVelocity(btVector3(0,0,0));
m_MyPhyModel->setContactProcessingThreshold(1e30);
m_MyPhyModel->setCcdMotionThreshold(getSize()); //like 0.5m
m_MyPhyModel->setCcdSweptSphereRadius(getSize()*0.5);

I'm not able to get collisions improvement: I see no changes with or without CCD. So, I would to ask if I'm searching ghosts or not :D In others word, I would to ask if it is possible to get CCD for kinematics objects in some way or if this technique is only possible for dynamics objects. In positive case, you can suggest to me some example or you can tell me if I mistake or forgot some step in btRigidBody setup or update?

Many thanks!
Nsoft
Posts: 2
Joined: Fri Jul 19, 2013 7:00 pm

Re: Using CCD and Kinematics Objects question

Post by Nsoft »

Hi, no one can give me an idea? :D Many thanks
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Using CCD and Kinematics Objects question

Post by xexuxjy »

Are you able to set a breakpoint to see if it's going into the CCD code ?( I think it's in btDiscreteDynamicsWorld::integrateTransforms , if it's not then it should give you some information as to why it's not .. (motion less than threshold etc)