setCollisionFlags

codemasterpl
Posts: 4
Joined: Fri May 27, 2011 12:23 pm
Location: Europe

setCollisionFlags

Post by codemasterpl »

Hi guys,

a quick thing here, enums for CollisionGroups and CollisionMasks

Code: Select all

	//These are the collision groups
	enum XCollisionGroups
   {

		   
		   GHOSTS = 64,  //They just have no collision at all 
		   WALLS = 128,  // BSP walls
		   ACTORS = 256, // Actors ( rigid bodies )
		   PLAYERS = btBroadphaseProxy::CharacterFilter
		 
		
   }; 
	

	//These are the masks for collision detection
	enum XCollidesWith
	{
		EVERYTHING = XCollisionGroups::ACTORS | XCollisionGroups::WALLS | XCollisionGroups::PLAYERS,
	           NOTHING = 0
	};




i create my rigidbody as per below:

Code: Select all

Game->Physics()->getDynamic()->addCollisionObject(newActor.m_ghostObject,X::XCollisionGroups::ACTORS,X::XCollidesWith::EVERYTHING);
and later on in the game, i would like to change the flag for this body, so it won't collide with anything - what i do is call:

Code: Select all

p_Body->setCollisionFlags(X::XCollidesWith::NOTHING);

The thing i want to achieve is to 'switch' from a 'colliding' MASK to not colliding at all, but it seems like setCollisionFlags doesn't really react..


What exactly setCollisionFlags do? Does it change the group or mask ?

Can i ask you to help me out with this please?
codemasterpl
Posts: 4
Joined: Fri May 27, 2011 12:23 pm
Location: Europe

Re: setCollisionFlags

Post by codemasterpl »

Ok,
used:

Code: Select all

p_Body->getBroadphaseHandle()->m_collisionFilterGroup=X::XCollisionGroups::GHOSTS;
As i couldn't find anything else..