Filtering raycast for CharacterController


I’m developing a videogame project with physX sdk 3.3.4.
I have used the raycast against the enviroment objects and it works properly (I can filter wich groups will hit the raycast and wich groups don’t).

But i want to add the CharacterController to a group to filter it too.

I’m creating the enviroment objects with code like this:

physx::PxShape* shape = m_PhysX->createShape(physx::PxTriangleMeshGeometry(triangleMesh), l_Material);
body = m_PhysX->createRigidStatic(physx::PxTransform(CastVec(aPosition), CastQuat(aOrientation)));

PxFilterData filterData;
filterData.word0 = group;


I’m using TriangleMeshes and primitive shapes too (like boxes, spheres…).

But i don’t know how to do the same with my character controller.

I create the controller by this way:

physx::PxCapsuleControllerDesc desc;
desc.height = height;
desc.radius = radius;
desc.climbingMode = physx::PxCapsuleClimbingMode::eCONSTRAINED;
desc.slopeLimit = cosf(3.1415f / 6); // 30
desc.stepOffset = 0.25f;
desc.density = density;
desc.reportCallback = this;
desc.position = physx::PxExtendedVec3(position.x, position.y + radius + height * 0.5f, position.z);
desc.material = l_Material;
desc.userData = (void*)index;

physx::PxController* cct = m_ControllerManager->createController(desc);

But I don’t know how to add the queryFilter data. I have found information about the filtering but it’s related to the filtering of the movement, and i need it for raycast.


PD: Sorry for my english, it isn’t my native language.

I have found the solution and here is for my case:

physx::PxController* cct = m_ControllerManager->createController(desc);
physx::PxShape* shape;
physx::PxRigidDynamic* l_actor = cct->getActor();
l_actor->getShapes(&shape, 1);

physx::PxFilterData filterData;
filterData.word0 = 0001;

m_CharacterControllers[characterControllerName] = cct;

I hope it can helps someone else.