-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error colliding collisionbody sphereshap or capsuleshap with other rigidbody #165
Comments
Can you compile the ReactPhysics3D in Debug mode and post here the whole stack trace when the error occurs ? |
With this debug code (if i'am right):
i obtain : Information World Physics World: Physics world world has been created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 105) 16:48:51 Information World Physics World: Initial world settings: worldName= gravity=Vector3(0.000000,-9.810000,0.000000) persistentContactDistanceThreshold=0.03 defaultFrictionCoefficient=1 defaultBounciness=0 restitutionVelocityThreshold=0.5 defaultRollingRestistance=0 isSleepingEnabled=0 defaultVelocitySolverNbIterations=20 defaultPositionSolverNbIterations=5 defaultTimeBeforeSleep=1 defaultSleepLinearVelocity=0.02 defaultSleepAngularVelocity=0.0523599 nbMaxContactManifolds=3 cosAngleSimilarContactManifold=0.95 (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 107) 16:48:51 Information World Physics World: Physics world world has been created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 110) 16:48:52 Information Body Body 0: New collision body created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 489) 16:48:52 Information Body Body 0: Set type=Static (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 123) 16:48:52 Information Body Body 0: Set isGravityEnabled=false (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 648) 16:48:52 Information Body Body 0: Collider 0 added to body (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 618) 16:48:52 Information Collider Collider 0: collisionShape=BoxShape{extents=Vector3(15.113791,22.065409,27.715946)} (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 622) 16:48:52 Information Body Body 2: New collision body created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 489) 16:48:52 Information Body Body 2: Set type=Static (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 123) 16:48:52 Information Body Body 2: Set isGravityEnabled=false (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 648) 16:48:52 Information Body Body 2: Collider 1 added to body (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 618) 16:48:52 Information Collider Collider 1: collisionShape=BoxShape{extents=Vector3(1154.007935,0.050000,1154.007935)} (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 622) 16:48:54 Information Body Body 4: New collision body created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 489) 16:48:54 Information Body Body 4: Collider 3 added to body (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 618) 16:48:54 Information Collider Collider 3: collisionShape=BoxShape{extents=Vector3(2.000000,2.000000,2.000000)} (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 622) 16:48:54 Information Body Body 4: Set mass=40.000000 (in file D:\reactphysics3d\src\body\RigidBody.cpp at line 554) 16:48:54 Information Body Body 6: New collision body created (in file D:\reactphysics3d\src\engine\PhysicsWorld.cpp at line 195) 16:48:54 Information Body Body 6: Collider 5 added to body (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 119) 16:48:54 Information Collider Collider 5: collisionShape=CapsuleShape{halfHeight=2.250000, radius=1.000000} (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 123) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) 16:48:54 Information Body Body 6: Set transform=Transform(Vector3(0.000000,10.000000,5.000000),Quaternion(0.000000,0.000000,0.000000,1.000000)) (in file D:\reactphysics3d\src\body\CollisionBody.cpp at line 401) ` no error in the html file at the end when it crash` my code
// RigidBody* bodya react_phys::Movable_body.body = world->createCollisionBody(transform); std::cout << "creation body for camera ok" << std::endl; } Movable_body.mCollider = Movable_body.body->addCollider(Movable_body.mCapsuleShape, transform); std::cout << "succes creating collider shape for actor" << std::endl;
}` |
Thanks a lot but what I really need it is a complete stack trace at the point where the error occurs. The error occurs at line 669 in file include/reactphysics3d/containers/Map.h. Could you please put a breakpoint here and run your code. When the breakpoint is hit, copy/paste the entire stack trace of your debugger here so that I can know where this method is called when the crash occurs. You are using the version v0.8.0 of the library right ? |
Yes i use v0.8.0. `Active debugger config: GDB/CDB debugger:Default [debug]Command-line: C:\Program Files\TDM64-GCC\gdb64\bin\gdb.exe -nx -fullname -quiet -args "D:/3D Engine-4/Antaria/bin/Debug/Antaria.exe" Starting debugger: C:\Program Files\TDM64-GCC\gdb64\bin\gdb.exe -nx -fullname -quiet -args "D:/3D Engine-4/Antaria/bin/Debug/Antaria.exe" [debug]Reading symbols from D:/3D Engine-4/Antaria/bin/Debug/Antaria.exe... Setting breakpoints [debug]>>>>>>cb_gdb: Debugger name and version: GNU gdb (GDB) 8.3.1 [debug]>>>>>>cb_gdb: In ?? () () [debug]> bt 30 |
Sorry but is this a stack trace ? I expect to see the whole tree of methods called when the error occurs. |
I just update the camera body according to user input using this:
` Thank you for your patience. |
i found that in my first project =
if i turn the world setting settings.isSleepingEnabled = true;
I know its better for you with stack trace. I will continu to investigate. It can probably come from my code. Best regards, |
Can you try this code: (i use 32 bit version of your librairy because all the rest of my project are in 32bit), it crash with the same error when the capsule body collide with ground and when a newtonian object have already collide : '#include <reactphysics3d/reactphysics3d.h> using namespace reactphysics3d; };
Quaternion orientation= Quaternion::identity();
Vector3 positionA(250,30,250); debugRenderer2.setIsDebugItemDisplayed(DebugRenderer::DebugItem::COLLISION_SHAPE, true); const float timeStep = 1.0f / 60.0f; const Transform& transformcube = cube.static_mesh.body->getTransform(); int tri=debug_Renderer->getNbTriangles(); } } |
with the 64 bit version of your librairy the stack trace is better: with breackpoint a line 669 in Map.h: `Active debugger config: GDB/CDB debugger:Default [debug]Command-line: C:\Program Files\TDM64-GCC\gdb64\bin\gdb.exe -nx -fullname -quiet -args D:/error/error/bin/Debug/error.exe Starting debugger: C:\Program Files\TDM64-GCC\gdb64\bin\gdb.exe -nx -fullname -quiet -args D:/error/error/bin/Debug/error.exe [debug]Reading symbols from D:/error/error/bin/Debug/error.exe... Setting breakpoints [debug]>>>>>>cb_gdb: Debugger name and version: GNU gdb (GDB) 8.3.1 [debug]>>>>>>cb_gdb: In __cxa_throw () () [debug]> bt 30 #4 0x0000000000401a24 in main () at D:\error\error\main.cpp:70 [debug]> bt 30 #4 0x0000000000401a24 in main () at D:\error\error\main.cpp:70 |
Thanks for the details. Anyway, I have just fixed an issue in the master branch. If you pull the last changes in this branch your error should not happen anymore. Let me know if the issue is now fixed on your side. Note that in your code, you create a CollisionBody for your movable mesh actor. You probably want to use a RigidBody here instead. A CollisionBody is only used to test for collisions with the PhysicsWorld::testCollision(...) or PhysicsWorld::testOverlap(...) methods. However, if you want your body to be simulated by the physics when you call the PhysicsWorld::update() method, you need to use a RigidBody instead. I hope this helps. |
Thank you for your help and your patience. It's work now. |
Thanks for your feedback. I am closing this issue. |
Hello,
I have created a collisionbody for my camera, and attach a capsuleshap on it. when it collide with somethink, my program crash. Same problem with sphereshap. It work only with boxshape.
My error:
"terminate called after throwing an instance of "std:runtime_error": what(): no item with given key have been found in the map.
My settings i use seems to be good:
CollisionBody* body;
CapsuleShape* mCapsuleShape;
Collider* mCollider;
The text was updated successfully, but these errors were encountered: