Disabling EVERY collision in one body.

Post Reply
aserrin55
Posts: 6
Joined: Wed Feb 08, 2017 11:30 pm

Disabling EVERY collision in one body.

Post by aserrin55 »

Hi everybody,

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:

Code: Select all

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?

Thanks a lot
S1L3nCe
Posts: 50
Joined: Thu Mar 24, 2016 10:22 am
Location: France

Re: Disabling EVERY collision in one body.

Post by S1L3nCe »

Hi,

If it's only visual, you should draw it with OpenGL without using Bullet.

Else you can use collision filtering : http://bulletphysics.org/mediawiki-1.5. ... _Filtering
Even if code is broken, text will explain you how it's working.

How to use :

Code: Select all

m_pWorld->addRigidBody(body, group, mask);
aserrin55
Posts: 6
Joined: Wed Feb 08, 2017 11:30 pm

Re: Disabling EVERY collision in one body.

Post by aserrin55 »

I have added a class that make every Bullet Body visual. Now, I want a flag or a configuration parameter that disables the collision of a concrete body.

I don't understand what you are saying about how to use: m_pWorld->addRigidBody(body, group, mask);
I think the web is broken

What can I do with this?
S1L3nCe
Posts: 50
Joined: Thu Mar 24, 2016 10:22 am
Location: France

Re: Disabling EVERY collision in one body.

Post by S1L3nCe »

Even if wiki code parts are broken, you still can read explications;

Collision Filtering give you a way to set Group and Mask to a Bullet body.
bullet performs an AND between object's A mask, and object's B group. If the result is anything but 0, Bullet will perform collision response
So with a mask equal to 0, a body won't collide with anything.

An other thread about this: http://bulletphysics.org/Bullet/phpBB3/ ... php?t=5449
Post Reply