Comments (5)
Actually, I just noticed that RigidBody actually already does this, I misread the documentation. Sorry! However, it certainly does still apply to Collision / Dynamics World, Bodies and Joints, perhaps being more important as it would help with consistency.
from reactphysics3d.
Yes, you are right. A body or a joint cannot outlive the World in which they have been added. However, they life can be shorter. A user should be able to call the destroyBody() or destroyJoint() methods if he wants to remove a body or a joint from the world before the end of the application for instance (for optimization because the object is not visible anymore, etc). Therefore, we need to keep those two methods to manually remove a body or a joint from the world.
I agree with you, the world destructor should be smarter. I propose to change the CollisionWorld and DynamicsWorld destructors so that they call the destroyBody() or destroyJoint() methods on every bodies or joints that have not been removed from the World yet.
It means that the user will still be able to manually remove a body (or joint) but if he doesn't, the World destructor will remove it automatically at the end.
from reactphysics3d.
Yes, that is exactly what I meant. Of course we still need to keep the destroy methods, for that reason. Splendid! :)
from reactphysics3d.
OK perfect. I will take care of this for the next release. Thanks a lot for reporting this.
from reactphysics3d.
I have implemented this in the commit 345afc1 in the develop branch.
This will be available in the next release of the library.
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.