Compiler error when using addRigidBody()

Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Compiler error when using addRigidBody()

Post by Mars_999 »

error C2663: 'btDiscreteDynamicsWorld::addRigidBody' : 2 overloads have no legal conversion for 'this' pointer

Code: Select all

class SphereTrigger : public Trigger
{
public:
	btSphereShape* shape;
	btMotionState* motionState;
	btRigidBody* body;

	SphereTrigger(const btDiscreteDynamicsWorld* world,
			      const cml::vector3f& pos, 
				  const float& radius, 
				  const ActorId& id)
	{
		shape = new btSphereShape(radius);
		btScalar mass = 0.0f;
		cml::matrix44f_c transform;
		transform.identity();
		//put pos into transform here
		motionState = new ActorMotionState(transform);
		btRigidBody::btRigidBodyConstructionInfo rbCI(mass, motionState, shape);
		body = new btRigidBody(rbCI);

		world->addRigidBody(body);//error is happening here!

		body->setCollisionFlags(body->getCollisionFlags() | btRigidBody::CF_NO_CONTACT_RESPONSE);
		body->setUserPointer((void*)&id);
	}
	virtual ~SphereTrigger()
	{
		if(shape)
			delete shape;
		if(motionState)
			delete motionState;
		if(body)
			delete body;
	}
};
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Re: Compiler error when using addRigidBody()

Post by Mars_999 »

Nevermind, argh....

SphereTrigger(btDiscreteDynamicsWorld* world,
const cml::vector3f& pos,
const float& radius,
const ActorId& id)

had const in the parameter list...