DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.54k stars 223 forks source link

Debug view #61

Closed Flibio closed 4 years ago

Flibio commented 6 years ago

In ReactPhysics3d, there should be a method of debug drawing. For example, the Bullet Physics library provides an interface that allows the user to implement a "draw line" method. Bullet then uses this method to draw a view of the physics world, showing the meshes and bounding boxes as the physics engine sees it. It would be incredibly useful and powerful to have this feature in ReactPhysics too.

I saw in the demo you can draw the bounding boxes, but the methods of doing so do not appear to be included in the main library. I think this would be a very useful addition to ReactPhysics.

DanielChappuis commented 6 years ago

Yes that's an excellent idea. I'll try to implement this. Thanks for the feedback.

maluoi commented 5 years ago

I'd +1 this!

Alternatively, I'd love to be able to iterate through the world's RigidBodies so I can easily debug render them myself. Right now you can query the number of RigidBodies, but the list of bodies is still protected.

DanielChappuis commented 5 years ago

I'd +1 this!

Alternatively, I'd love to be able to iterate through the world's RigidBodies so I can easily debug render them myself. Right now you can query the number of RigidBodies, but the list of bodies is still protected.

Thanks a lot for you feedback.

Currently, when you create a body with createCollisionBody() or createRigidBody(), those methods return a pointer to the created body. You can then generate a list of the bodies on your side in order to render them.

maluoi commented 5 years ago

That's what I'm doing right now! Works well enough. :)

I suppose it just threw me off having a function for counting the number of RigidBodies, but not one to access them! When I saw the one, I kinda expected to find the other. All good!

DanielChappuis commented 5 years ago

Add DebugRenderer class

DanielChappuis commented 4 years ago

The version v0.8.0 of ReactPhysics3D has been released. In this version, there is now a DebugRenderer class that can be used to display debugging info (collision shapes, contacts, ...) in your application using primitives like lines and triangles. Take a look at the user manual here to learn how to use this new feature.

Note that this version contains some public API changes. Please read carefully the change log before upgrading to this new version and do not hesitate to take a look at the user manual.

Thanks a lot for your feedback. I am now closing this issue.