Please watch the video. I have adjusted minZ and maxZ, but the situation in the video may occur
I bet on wrong bounding boxes/ wrong bounding volume.
Does it still happen if you freeze the scene? scene.freezeActiveMeshes
Is there a way to display bounding volumes? @sebavan
@brightMoon, as usual, can you provide a PG please ?
Simple way to show all bounding boxes.
scene.meshes.forEach(e => {
e.showBoundingBox = true
})
Although the skeletal model in the video is static, I’m guessing that it’s actually animated, causing the mesh to actually be far away from the bounding box.
The simplest fix is to force alwaysSelectAsActiveMesh on all the meshes from the character in this case but a playground is always great to also demo the issue and help others.
Normal display:
MeshDebugPluginMaterial:
I am certain that the issue is caused by MeshDebugPluginMaterial.
Please comment on line 8 of the pg code to see the effect
Look at this example:
So why can MeshDebugPluginMaterial affect the borders of objects?
See pg.
It appears that PrepareMeshForTrianglesAndVerticesMode(mesh)
is causing the problem.
I checked the source code, and the deeper reason is that he is calling mesh.convertToUnIndexedMesh()
, which modifies the mesh vertices (line 26).
A simpler solution would be to call mesh.refreshBoundingInfo(true)
, which refreshes the boundinginfo, and takes the skeleton into account (line 28).
But I’m not sure why calling convertToUnIndexedMesh() on the skeleton mesh results in a boundingBox error.
Translated with DeepL Translate: The world's most accurate translator (free version)
Very good, mesh.refreshBoundingInfo (true)
can indeed solve the problem
The specific reason needs to be explained by the official maintainer
@Evgeni_Popov could it be related to your latest changes there ? I do not think so cause the stride as nothing to do here but just wondering before having a deeper look
The bounding infos are lost when calling convertToUnIndexedMesh
, indeed. This PR will fix it: