Collision callback and sphereshape

Post Reply
Posts: 2
Joined: Thu Mar 15, 2012 8:02 pm

Collision callback and sphereshape

Post by mnunesvsc » Wed May 15, 2019 2:36 pm

I am using bullet for physiscs and collision detection for a game, and on my callback code, i can capture all colisions, except sphere vs sphere, is something i am doing wrong

the collision is ocurring because the objects are deflected but the bodies are not coming to the callback

here follow some code i use on creation of the collision objects

the shot sphere

Code: Select all

    colShape = new btSphereShape(2); // 2
    btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
    btVector3 localInertia(0, 0, 0);
    if (isDynamic) colShape->calculateLocalInertia(mass, localInertia);

    //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
    btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
    btRigidBody::btRigidBodyConstructionInfo rbInfo(mass, myMotionState, colShape, localInertia);
    btRigidBody* body = new btRigidBody(rbInfo);
   dynamicsWorld->addRigidBody(body, COL_PRFR, COL_GRND | COL_BUILD | COL_DEBRIS | COL_ENSP );
the other sphere

Code: Select all

    colShape = new btSphereShape( 2 * 1. );
    btScalar mass(16.f);
    btRigidBody* body = createRigidBody(dynamicsWorld, mass, startTransform, colShape, COL_ENSP, COL_GRND | COL_BUILD | COL_DEBRIS | COL_SHIP | COL_PRFR | COL_ENSP );

Can anyone can help ?

Peace for all

Post Reply