[Solved-ish]Blender+Bullet: Export collision filter flags

Post Reply
efaj
Posts: 8
Joined: Sun Dec 09, 2012 12:30 pm

[Solved-ish]Blender+Bullet: Export collision filter flags

Post by efaj »

Blender 2.65 exposes 8 collision groups and filter masks through it's UI.
I've read several information from different sources that has me confused -mostly surrounding a patch that apparently exposed this flags- so I've come here to clear whether or not this correlates to bullet flags (and how, if blender has some reserved groups itself), if and how they can be exported, or even "easier" and more certain, if I can somehow set the flags to be exported before exporting the .bullet file-.

How does this (if it does) corresponds to Bullet collision bits when exporting through

Code: Select all

#press spacebar to save a testFile.bullet
# Erwin Coumans

print ("hello world")
import PhysicsConstraints;
PhysicsConstraints.setGravity(0,0,0)
PhysicsConstraints.exportBulletFile("test.bullet")
?

Currently, I have

Code: Select all

enum collisiontypes {
		COL_NOTHING = 0, //<Collide with nothing
		COL_WALL = 1<<0, //<Collide with environment
		COL_ACTOR = 1<<1, //Collide with Players/NPCs
		COL_SENSOR = 1<<2, //<Collide with sensors
	};
And I'm expecting to be able to set the exported object to have COL_WALL flag (I'm using blender just to approximate environment geometry).
Even a way to see the exported flags would be useful, especially since I have no idea if blender implements it's own collision filtering, how it does it, how it correlates to bullet flags (if it does) and if it has some special reserved groups.

How have you been able to do it? (Since I suppose others have done this before, even before Blender 2.65)

EDIT:
I solved my subproblem of how to see the exported flags through some source browsing:

Code: Select all

        std::cout<<fileLoader->getNumRigidBodies()<<std::endl;
	std::cout<<fileLoader->getNameForPointer(fileLoader->getRigidBodyByIndex(0))<<std::endl; //Gets the name of the object. This is the name of the mesh in Blender.
	std::cout<<fileLoader->getRigidBodyByIndex(0)->getBroadphaseHandle()->m_collisionFilterGroup
			<<std::endl; 
	std::cout<<fileLoader->getRigidBodyByIndex(0)->getBroadphaseHandle()->m_collisionFilterMask
			<<std::endl;
Running tests atm.

EDITx2:
Blender's flags aren't exported. The object type does affect bullet flags... for example, rigid body is group 1, and mask FF, while static is group 2, and mask 1111 1101.

So, the original problem still stands... how to change the FilterGroup and Mask? I guess I could make a separate standalone, but I'd rather there was a way from Blender... like using PhysicsConstraints or something...

Editx3:
I changed my flags to match Blender's. Given that I only use it for static geometry shapes, I set my COL_WALL to 1<<1 to match the static group.
Post Reply