EDIT: After spending a bit of time understanding the code I wrote I still don't know what is wrong with it. This is the base class from which I derived my class:
///ContactResultCallback is used to report contact points
struct ContactResultCallback
{
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
ContactResultCallback()
:m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual ~ContactResultCallback()
{
}
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1) = 0;
};
Now here is my derived class:
class DisablePairCollision : public btCollisionWorld::ContactResultCallback
{
public:
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* colObj0, int32_t partId0, int32_t index0, const btCollisionObject* colObj1, int32_t partId1, int32_t index1);
btDiscreteDynamicsWorld* DynamicsWorld;
};
And below is where I implement the main function. Still not sure why I'm getting this error.
I was using the code below on windows with both vc2010 and code blocks without a problem:
btScalar DisablePairCollision::addSingleResult(btManifoldPoint& cp, const btCollisionObject* colObj0, int32_t partId0, int32_t index0, const btCollisionObject* colObj1, int32_t partId1, int32_t index1)
{
// Create an identity matrix.
btTransform frame;
frame.setIdentity();
// Create a constraint between the two bone shapes which are contacting each other.
btGeneric6DofConstraint* Constraint;
Constraint = new btGeneric6DofConstraint( *(btRigidBody*)colObj0, *(btRigidBody*)colObj1, frame, frame, true );
// Set limits to be limitless.
Constraint->setLinearLowerLimit( btVector3(1, 1, 1 ) );
Constraint->setLinearUpperLimit( btVector3(0, 0, 0 ) );
Constraint->setAngularLowerLimit( btVector3(1, 1, 1 ) );
Constraint->setAngularUpperLimit( btVector3(0, 0, 0 ) );
// Add constraint to scene.
DynamicsWorld->addConstraint(Constraint, true);
return 0;
}
Now I'm trying to compile my project on Ubuntu but I am getting this error when I try to use that class:
/home/steven/Desktop/ovgl/src/OvglScene.cpp:211: error: cannot declare variable ‘Callback’ to be of abstract type ‘Ovgl::DisablePairCollision’
Callback
? – Laborsaving