Using: VS2017 - Win32 - Debug, PhysX 3.4.1, Windows 10, Debug libraries/dlls
I’m getting 2 assert errors and I don’t know what is the problem.
Assert 1
This assert is thrown when I set an exclusive shape as Trigger. http://es.tinypic.com/r/b515hc/9
Assert info:
Debug Assertion Failed!
Program: ...nts\GitHub\Project3\EngineResources\PxFoundationDEBUG_x86.dll
File: ..\..\LowLevelAABB\src\BpSimpleAABBManager.cpp
Line: 1981
Expression: ..\..\LowLevelAABB\src\BpSimpleAABBManager.cpp(1981) : Assertion failed: !mRemovedHandleMap.test(handle)
Creating the shape:
physx::PxShape * ModulePhysics::CreateShape(physx::PxRigidActor& body, physx::PxGeometry& geometry, physx::PxMaterial& mat)
{
physx::PxShape* shape = physx_physics->createShape(geometry, mat, true);
body.attachShape(*shape);
shape->release();
return shape;
}
Using “physx::PxRigidActorExt::createExclusiveShape(body, geometry, mat);” have the same result.
Setting the shape as trigger:
void ComponentCollider::SetTrigger(bool trigger)
{
collider_shape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !trigger);
collider_shape->setFlag(physx::PxShapeFlag::eTRIGGER_SHAPE, trigger);
}
Assert 2
This assert is thrown when enabling GPU RigidBodies, creating a joint and setting one of the actors as Kinematic. Without setting them as kinematic or not using GPU rigidbodies, it works. GPU RB + Joint = OK, Joint + Kinematic = OK, GPU RB + Joint + 1 Actor Kinematic = Error. http://es.tinypic.com/r/2jer0ir/9
Assert info:
Debug Assertion Failed!
Program: ...nts\GitHub\Project3\EngineResources\PxFoundationDEBUG_x86.dll
File: ..\..\GpuSolver\src\PxgDynamicsContext.cpp
Line: 2098
Expression: ..\..\GpuSolver\src\PxgDynamicsContext.cpp(2098) : Assertion failed: (nbPatches + islandSim.getNbActiveEdges(IG::Edge::eCONSTRAINT)) == accumulatedConstraints
Scene with GPU RB:
void ModulePhysics::CreateMainScene()
{
physx::PxCudaContextManagerDesc cudaContextManagerDesc;
cuda_context_manager = PxCreateCudaContextManager(*physx_foundation, cudaContextManagerDesc);
physx::PxSceneDesc sceneDesc(physx_physics->getTolerancesScale());
sceneDesc.gravity = physx::PxVec3(0.0f, -9.81f, 0.0f);
dispatcher = physx::PxDefaultCpuDispatcherCreate(4);
sceneDesc.cpuDispatcher = dispatcher;
sceneDesc.filterShader = CCDShader;
sceneDesc.gpuDispatcher = cuda_context_manager->getGpuDispatcher();
sceneDesc.simulationEventCallback = this;
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_GPU_DYNAMICS | physx::PxSceneFlag::eENABLE_ACTIVE_ACTORS | physx::PxSceneFlag::eENABLE_PCM;
sceneDesc.broadPhaseType = physx::PxBroadPhaseType::eGPU;
main_scene = physx_physics->createScene(sceneDesc);
main_scene->setVisualizationParameter(physx::PxVisualizationParameter::eSCALE, 1.0f);
main_scene->setVisualizationParameter(physx::PxVisualizationParameter::eCOLLISION_SHAPES, 2.0f);
}
Without GPU RB:
void ModulePhysics::CreateMainScene()
{
physx::PxSceneDesc sceneDesc(physx_physics->getTolerancesScale());
sceneDesc.gravity = physx::PxVec3(0.0f, -9.81f, 0.0f);
dispatcher = physx::PxDefaultCpuDispatcherCreate(4);
sceneDesc.cpuDispatcher = dispatcher;
sceneDesc.filterShader = CCDShader;
sceneDesc.simulationEventCallback = this;
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVE_ACTORS | physx::PxSceneFlag::eENABLE_PCM;
main_scene = physx_physics->createScene(sceneDesc);
main_scene->setVisualizationParameter(physx::PxVisualizationParameter::eSCALE, 1.0f);
main_scene->setVisualizationParameter(physx::PxVisualizationParameter::eCOLLISION_SHAPES, 2.0f);
}
Creating Joint:
//JointComponent.cpp
physx::PxVec3 offset = physx::PxVec3(0, 0, 0);
joint = App->physics->CreateDistanceJoint(rigidbody, physx::PxTransform(offset), nullptr, physx::PxTransform(offset));
//PhysicsModule.cpp
physx::PxDistanceJoint* ModulePhysics::CreateDistanceJoint(physx::PxRigidActor * actor0, const physx::PxTransform & localFrame0, physx::PxRigidActor * actor1, const physx::PxTransform & localFrame1)
{
return physx::PxDistanceJointCreate(*physx_physics, actor0, localFrame0, actor1, localFrame1);
}
Setting as Kinematic:
void ComponentRigidBody::SetKinematic(bool kinematic)
{
rigidbody->setRigidBodyFlag(physx::PxRigidBodyFlag::eKINEMATIC, kinematic); //Kinematic = true;
}
PD: I’m not getting those errors in release mode using release libraries/dlls and it works but not in debug. These errors are thrown when calling “scene->fetchResults(true);”.
Thanks.