reactphysics3d icon indicating copy to clipboard operation
reactphysics3d copied to clipboard

feature: Selective debug rendering

Open breautek opened this issue 3 years ago • 1 comments

Hi there,

This change adds a boolean state on CollisionBody and 2 methods for a setter/getter, which controls whether or not to compute debug lines on a particular collision body. Furthermore, the DebugRenderer uses this state to decide whether to enter the body, or to skip it.

The rationale for this change is to allow selectively which bodies to render the debug lines, rather than computing lines for everything. Sometimes you don't care about every physical body when debugging, just a particular body that might be misbehaving.

Breaking Changes

There is a minor breaking change in that, the default value for this state flag is false, so by enabling the debugger, nothing will be computed by default until you set the debug state to true on at least one body. Should this PR be accepted, this should be documented in the user manual, but I'm unsure the proper way of editing tex files or the process of generating the PDF.

If you can direct me on the process of updating the documentation, I can build a new PR or add it to this PR.

Testing

I couldn't find any unit tests regarding the DebugRenderer, nor could I figure out how to use the testbed app (CMake kept on complaining that I wasn't in a git repository even though I was) but I have tested these changes in my own project.

I've attempted to follow similar terminology and existing code patterns, but if something is written in a different than preferred way, please do let me know.

I've considered adding this flag onto the Collider itself, but I figured that most of the time with debugging, you'd be concerned with the general body as a whole.

Cheers,

breautek avatar Apr 05 '22 03:04 breautek

Thanks a lot for your pull request.

Selective debug rendering is a good idea. I agree, it is better to do it on the body and not on the collider.

I will review this when I have some time. Thanks !

DanielChappuis avatar Apr 05 '22 06:04 DanielChappuis

I have merged this feature into the master branch. This will be available in the next release of the library. Thanks a lot for taking the time to implement this.

DanielChappuis avatar Jan 09 '24 17:01 DanielChappuis