Hello everyone,
I tried to use RapierHelper (available from r176) to debug a RapierJS physic world, based on the three.js physics - rapier3d character controller exemple, rendered with WebGPURenderer.
The physic works as expected, the collisions are detected, the mesh positions updated based on the physic world bodies and the debug vertices from the world.debugRender()
are updated accordingly.
But the RapierHelper “mesh” using the debug vertex positions is not updated. The RapierHelper “mesh” stays at its initial position. This happens with WebGPURenderer but works fine with WebGLRenderer (as for the example on threeJS).
As far as I could debug, I found out that the the “position” BufferAttribute is correctly updated with the up to date vertex positions from Rapier world.debugRender()
.
From RapierHelper source code, I saw that the current “position” BufferAttribute is deleted from the geometry then a new “position” BufferAttribute is created and assigned to the BufferGeometry in the update
method (called in the render loop), so the BufferAttribute version
property is always 0.
Question:
Could this be the source of the issue ? Or with WebGPURenderer are there some extra/specific steps needed to update a BufferGeometry vertex position ?
I create 2 codepens, based on source code of the character controller example from three examples that demonstrate the different behaviors between :
WebGPURenderer :
https://codepen.io/Eman-Ymton/pen/gbbXEJv
WebGLRenderer:
https://codepen.io/Eman-Ymton/pen/VYYrNQX
Thanks.