[Bug?] filterData for character controller

Hey. What i’m trying to do is prevent Character Controller interacting with certain type of objects. So i thought, i can use filter data, it works for normal shapes. In order to provide filterData for PxController, i pass it while calling to PxController::move(…) with PxControllerFilters. So for a quick test i do it like this:

PxFilterData characterFilterData;
characterFilterData.word0 = 1;

PxControllerFilters characterControllerFilters;
characterControllerFilters.mFilterData = &characterFilterData;

mPlayerController->move(PxVec3(Player.moveOffset.x, Player.moveOffset.y, Player.moveOffset.z), 0.1f, deltaTime, characterControllerFilters, NULL);

and that’s enough to cause mPlayerController to stop interacting with the world(it just falls through stuff).

the weird thing is the line that causes such behavior is “characterFilterData.word0 = 1;”.

so i found out that it happens if i set any of characterFilterData member variables to value other than zero. can someone explain why?

and BTW, it happens even if i use simulation shader like this one:

PxFilterFlags PhysicsMainFilterShader(PxFilterObjectAttributes attributes0, PxFilterData filterData0,
                                      PxFilterObjectAttributes attributes1, PxFilterData filterData1,
                                      PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{
    pairFlags = PxPairFlag::eCONTACT_DEFAULT;
    return PxFilterFlag::eDEFAULT;
}

and Character Controller is initialized like that:

PxBoxControllerDesc playerBoxDesc;
		playerBoxDesc.material = mCharacterMaterial;
		playerBoxDesc.density = 100.0f;
		playerBoxDesc.halfHeight = 0.75f;
		playerBoxDesc.halfSideExtent = 0.24f;
		playerBoxDesc.halfForwardExtent = 0.225f;
		playerBoxDesc.contactOffset = 0.01f;
		playerBoxDesc.contactOffset = 0.05f;
		playerBoxDesc.slopeLimit = 0.2f;
		playerBoxDesc.stepOffset = 0.175f;

		mPlayerController = (mControllerManager->createController(*mPhysics, mScene, playerBoxDesc));
		mPlayerController->setFootPosition(PxExtendedVec3(Player.position.x, Player.position.y, Player.position.z));

can anybody point out anything wrong with it? i fail to come up with any valid logical reason for it to happen, so is suspect it may be a bug.
i’m using PhysX 3.2.4.

Hi,

I may be wrong but I think there is no such bug with CCT filtering. Perhaps collision only occures with default shader if (shader1 == 0 && shader2 == 0) || ((shader1.word0 & shader1.word1) | (shader1.word1 & shader1.word1) | (shader1.word2 & shader1.word2) | (shader1.word3 & shader1.word3)). You can also look inside the guide in Callbacks and Customization > Collision Filtering to understand how it works. I have implemented a physX 3.2.4 plugin for a 3D engine and was able to filter CCT collision against certain objects (What I was not been able to achieve though is CCT/CCT collision filtering. I wasn’t able to have a CCT pass through another). I it is possible to provide a simple project, I would be glad to help you.

here’s the basic reproduction case, i hope you’re OK with just a single source file listing. project is just a default MSVC 2010 Console Application. PhysX SDK version is 3.2.4;
http://pastie.org/private/exnuwpr2qrez9tigslt3bq

i’ve compiled it, watched through PVD and Character Controller fallen through the “floor”. line, that causes such behavior is surrounded with comments. if you comment it out, it works fine. tested with default and custom(most basic two-liner without any conditions) shader.

i’ve also tried to do it that way, instead of providing filtering data on “move()” function call:

characterTempActor = mPlayerController->getActor();
characterTempActor->getShapes(&aTempShape, 1);
tempShape->setSimulationFilterData(mCharacterFilterData);

it didn’t work either. character controller just collided with everything. but again, it works with regular actors.

Since nobody had any comment and suggestions on that, i posted it as a bug report on developer center. Only to find out that there’s same attention amount to bug submissions(i have no idea about status of my submission. i can’t tell if someone read it in 10 days since i posted it. i didn’t get any kind of response\confirmation). It kind of wastes my time, because i’m still uncertain about the nature of the problem and what to do with it. Maybe i’m doing something really stupid, misunderstanding something really badly? I’d like to find out.

Hi,

Sorry for the delay (was a little busy). I checked your code and also don’t understand how this work (I had the same problem and wasn’t able to solve it). Perhaps this is finally a bug. Anyway, another way to achieve what you want to do is by using preFilter callback. Also you can modify the source code of Character controllers if you want to.

well… it has been almost a month since i’ve posted a bug submission. nor it was reviewed, nor i’ve got any answer from PhysX staff on this forum. either they’re too busy, or it is not a real bug.

Is there any update on this problem? I suffer the exact same thing on 3.2.4

*Edit:

Nevermind i appear to have got it working now.

Hi,

Can you please give some tips? that will help N01(and me :)) to understand the problem. Thanks in advance.

Yeah sure here ya go http://pastie.org/private/xkib2jdenop09npezoaixa

I just modified the above to make it work, i added a “health” box to help demonstrate it all. The player should fall through the health box but not the floor.

Thanks,

So it is the opposite of what I(we) thought in the first time. You need to specify the bitmask for the groups you want to be included in the collision.

Yeah when you set it up that way with the collider against group. Take a look at the submarine sample as it shows another way of using it.

Thanks very much. I was with similar problem.

Here my post
https://devtalk.nvidia.com/default/topic/666014/?offset=15#4154315

This line don’t exist more in PhysX

playerBoxDesc.interactionMode = physx::PxCCTInteractionMode::eUSE_FILTER;//check the API docs for this

I don’t was seting the queryfilterdata:

pxShape->setSimulationFilterData(filterData);
pxShape->setQueryFilterData(filterData);

I actually revisited this issue today. And stumbled upon the same problem.
Writing something like that for regular shapes seems to work:

npcList[f].hitSpheres[b].filterData.word0 = PhysicsFilterGroups::NP_NORMAL; //bitmask of the object
npcList[f].hitSpheres[b].filterData.word1 = PhysicsFilterGroups::NP_TRIGGER; //bitmask for groups it collides with

with a shader like that:

PxFilterFlags PhysicsMainFilterShader(PxFilterObjectAttributes attributes0, PxFilterData filterData0,
									  PxFilterObjectAttributes attributes1, PxFilterData filterData1,
									  PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{
	if(!(filterData0.word0 & filterData1.word1) || !(filterData0.word1 & filterData0.word0)) {
		return PxFilterFlag::eKILL;
	}
	// generate contacts for all that were not filtered above
	pairFlags = PxPairFlag::eCONTACT_DEFAULT | PxPairFlag::eTRIGGER_DEFAULT | PxPairFlag::eNOTIFY_CONTACT_POINTS;
	return PxFilterFlag::eDEFAULT;

}

but it seems that character controllers and raycast follow their own BS rules. they don’t use that shader. so changing any “wordX” value for them results in no collision. So are there other shaders you can specify besides “PxSceneDesc::filterShader” one? Or what logic do they actually use? Or where do you seek for an example? Submarine sample doesn’t even use character controller.

Like it was mentioned above, the character controller uses scene queries, so all you need to do is set the appropriate scene query flags on your shapes with PxShape::setQueryFilterData (instead of PxShape::setSimulationFilterData).

yes, i fixed it by now. it’s just when you try to implement it inside of already working system, it can get really confusing. it would be nice if documentation section on character controllers did elaborate on filtering, mentioning these little details, describing logics of interactions better and referencing documentation on query filtering.