When ever I toggle “Render wire frame over mesh” under the debug drop down, it renders a wireframe that appears to be offset from the mesh that it’s supposed to be covering:
I don’t think the styling I applied to the debugger would be causing any issues as all it does is ensure that the debugger UI is positioned over any other dom elements in the screen.
Does anyone have an idea of how or why this bug is happening?
Hello! I also don’t think it’s the styling’s fault, but it might be something with the mesh. Can you see if the same thing happens if you load the mesh in the playground instead of your project?
EDIT: I realized that if I comment out the function call on line 114 to create a mesh impostor from the heightmap mesh, the alignment seems to be fixed
This actually lines up with what I’ve been observing in my project:
the ammojs physics mesh imposter is shifted in someway so that it’s not aligned with the mesh it’s supposed to represent. This causes other objects such as a sphere, to appear to fall through the ground, or the inverse collide with an invisible object.
I’ve just tried with bjs 5.1.0 and with ‘render wireframe over mesh’ or ‘physics’ helpers, I get a perfect alignment with the ground.
I did a fix some days ago, might be related or I missed smth while testing your PG.
‘Render wireframe over mesh’ clones the mesh with a deep copy. Deep copy also copies physics Impostor and with an impostor delta, it breaks things (with more memory allocated).
PR with the fix coming in a few hours.
we publish nightlies. our playground is using these nightlies, so you can test a playground against those changes. Otherwise, it will be included in the next npm release, which will probably happen tomorrow.
Oh sweet so y’all are still putting fixes in for tomorrow’s release! There’s one more thing I noticed, I’m gonna try and see if I can replicate it in the playground
@Cedric@RaananW When you have a moment, please take a look at this one:
Repo steps:
toggle physics grid on
in the console run window.addballs()
You will very quickly see that the actual physics object that is supposed to represented by the height map mesh is either shifted, rotated or both in some way that makes the visual representation not correct.
mesh.physicsImpostor.setDeltaRotation(rootMesh.rotationQuaternion || new Quaternion(0, 0, 0, 1))
setDeltaRotation and setDeltaPosition tell the engine how the physics impostor is compared to the rendered mesh.
With the value set for rotation, the impostor will be rotated and the display will not be in sync with the physics.
If you want to rotate the terrain, then use mesh.rotation then create the impostor.
delta postion/rotation is for adjusting impostor compared to the mesh.
Easy example is when you have a box mesh with its center at the base of the mesh, not at the center.
Then, you need a delta because the box impostor always assume origin to be at the center.