0
votes

I'm working with Bullet and OpenGL and basically I have one body, that I want it to appear in the screen but not to suffer collisions.

It only has to be visual.

I'am creating the object like this:

btBoxShape* colShape = createBoxShape(btVector3(1, 1, 1));
m_collisionShapes.push_back(colShape);
btTransform startTransform;
startTransform.setIdentity();
btScalar mass(0.5f);
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0, 0, 0);
   if (isDynamic)
       colShape->calculateLocalInertia(mass, localInertia);
startTransform.setOrigin(btVector3(5.0, 0.5, 0.0));
createRigidBody(mass, startTransform, colShape);

It does not have to collide or interact with any other bullet body.

Is there any flag or something like that in order to get this?

2

2 Answers

1
votes

Just draw whatever you want to draw, without passing it into the physics engine calculations. OpenGL is completely unconcerned with collision calculations, you can draw with OpenGL whatever you want.

0
votes

The easiest way to make a RigidBody not collide with anything is to set it's collision group and mask to 0.

When adding rigid body to the world

mWorld->addRigidBody(object, 0, 0);

Note, however that if it's a dynamic body it's going to be still affected by gravity and it will fall down. But of course you can use such configuration if you need it. Just keep in mind that it will ignore all collisions but forces can still be applied to such a body.