Comments (11)
Hello. It seems to happen in the call of the DynamicsWorld.update() method. Are you doing something special in your code before you call this method (between this call and the previous one) ? Like adding, removing bodies from the world ?
Also, where the assert is hit, can I ask you what is the value of the variables "indexBody" and "mSplitLinearVelocities.size()" ?
from reactphysics3d.
Hi
Backtrace with debug build looks like:
(gdb) bt
#0 0x000000000050846a in reactphysics3d::Vector3::operator= (this=0x83a3704f8, vector=@0x7fffdfbfa750) at Vector3.h:360
#1 0x00000000009e7bfa in reactphysics3d::DynamicsWorld::integrateRigidBodiesVelocities (this=0x8062b0000) at ext/reactphysics3d/src/engine/DynamicsWorld.cpp:301
#2 0x00000000009e7278 in reactphysics3d::DynamicsWorld::update (this=0x8062b0000, timeStep=0.0160000008) at ext/reactphysics3d/src/engine/DynamicsWorld.cpp:132
#3 0x00000000004ebdbb in tdme::engine::physics::World::update (this=0x8062b0000, deltaTime=0.0160000008) at src/tdme/engine/physics/World.cpp:179
I need collision bodies for several game features.
Best regards
Andreas
from reactphysics3d.
I will do today.
from reactphysics3d.
I am adding a collision body in a frame and then just remove it after several frames(means after several world.update() calls). So nothing special at all. Meanwhile I do not add or remove bodies.
from reactphysics3d.
I have added the following line to debug:
Console::println(to_string(mBodies.size()) + ":" + to_string(indexBody));
(mSplitLinearVelocities is a C++ Array, not a STL container or something)
Before the game crashes it prints:
573:6337680
573:571
from reactphysics3d.
Oh overread that too fast.
Also, where the assert is hit, can I ask you what is the value of the variables "indexBody" and "mSplitLinearVelocities.size()" ?
I will check tomorrow. I have made changes to TDME2 that requires me to modify game logics too.
from reactphysics3d.
Hi,
please see attached a patch that fixes the crash.
diff --git a/ext/reactphysics3d/src/engine/DynamicsWorld.cpp b/ext/reactphysics3d/src/engine/DynamicsWorld.cpp
index 91112d74..68eff2ab 100644
--- a/ext/reactphysics3d/src/engine/DynamicsWorld.cpp
+++ b/ext/reactphysics3d/src/engine/DynamicsWorld.cpp
@@ -746,13 +746,18 @@ void DynamicsWorld::computeIslands() {
// Check if the current contact manifold has already been added into an island
if (contactManifold->isAlreadyInIsland()) continue;
+ // Get the other body of the contact manifold
+ RigidBody* body1 = dynamic_cast<RigidBody*>(contactManifold->getBody1());
+ RigidBody* body2 = dynamic_cast<RigidBody*>(contactManifold->getBody2());
+
+ // if body1 or body2 is nullptr dynamic cast have failed due to beeing collision body
+ if (body1 == nullptr || body2 == nullptr) continue;
+
// Add the contact manifold into the island
mIslands[mNbIslands]->addContactManifold(contactManifold);
contactManifold->mIsAlreadyInIsland = true;
- // Get the other body of the contact manifold
- RigidBody* body1 = static_cast<RigidBody*>(contactManifold->getBody1());
- RigidBody* body2 = static_cast<RigidBody*>(contactManifold->getBody2());
+ //
RigidBody* otherBody = (body1->getId() == bodyToVisit->getId()) ? body2 : body1;
// Check if the other body has already been added to the island
@@ -781,6 +786,10 @@ void DynamicsWorld::computeIslands() {
// Get the other body of the contact manifold
RigidBody* body1 = static_cast<RigidBody*>(joint->getBody1());
RigidBody* body2 = static_cast<RigidBody*>(joint->getBody2());
+
Best regards
Andreas
from reactphysics3d.
Yes thanks. I have also found how to solve it yesterday evening with this commit. I was just running some tests to see that this fix was OK. I think our patches are similar.
I have pushed my changes into the develop branch. Could you test if the issue is also resolved on your side with the develop branch ?
from reactphysics3d.
Ok. Nice. Will test later today.
from reactphysics3d.
Seems to be fixed. Thank you.
from reactphysics3d.
Ok Thanks. The fix is now merged in the master branch.
from reactphysics3d.
Related Issues (20)
- 0.10.0 - Raycasting gives incorrect results for HeightFieldShape when scaling factor is applied HOT 2
- Child somewhat-static collision shape HOT 1
- Ticking different objects at different rates HOT 1
- v0.10.0: Assertion Failed in NarrowPhaseInfoBatch::addContactPoint() HOT 2
- Why is the collision not happening how I think it should? HOT 3
- 0.10.0 - createConvexMeshShape example provided in manual doesn't work HOT 4
- find mistake in code HOT 2
- Rigid bodies without colliders escape from joint with a rigid body with collider. HOT 2
- ConvexMeshShape issue (assert) HOT 1
- Failed assertion in OverlappingPairs::setNeedToTestOverlap in v0.10.1 HOT 2
- Is there any way to get angular rotation relative to an object?
- continuous collision detection
- vehicle dynamics support
- soft body support
- more collision shapes
- adding impulses
- boyancy calculation HOT 1
- character controllers HOT 3
- Trigger Collider are active when added to an inactive RigidBody HOT 2
- Constant SIGTRAP in the MemoryManager destructor only on windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactphysics3d.