Do not set geom_dataid for primitives fitted to a mesh. - #3471
Open
robertomeroni wants to merge 1 commit into
Open
Do not set geom_dataid for primitives fitted to a mesh.#3471robertomeroni wants to merge 1 commit into
robertomeroni wants to merge 1 commit into
Conversation
A geom whose type is a primitive but which carries a mesh= attribute is fitted to that mesh, and XMLreference states that the compiled mjModel holds "no reference to the mesh used for fitting". mjCGeom::Compile clears meshname_ to that end, but IndexAssets runs afterwards and re-resolves geom->mesh from spec_meshname_, which is untouched, so CopyTree stored the mesh id anyway. The stale id defeats the geom_dataid == -1 early-out in mjc_PlaneConvex, which then walks the fitting mesh and can emit up to 3 contacts into a buffer that mj_maxContact sized at 1 for a plane-ellipsoid pair: SIGSEGV, or the driver's own contact-count check firing. Saving and reloading the same model produced a correct geom_dataid of -1, so the two paths disagreed. Gate the assignment on the geom type, matching the guard used elsewhere in the compiler (user_model.cc:5317). Fitted primitives now also render as primitives: texture repeat is no longer divided by geom size, and mjVIS_MESHBVH no longer draws the fitting mesh's bounding volumes on them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A geom whose type is a primitive but which carries a mesh= attribute is fitted to that mesh, and XMLreference states that the compiled mjModel holds "no reference to the mesh used for fitting". mjCGeom::Compile clears meshname_ to that end, but IndexAssets runs afterwards and re-resolves geom->mesh from spec_meshname_, which is untouched, so CopyTree stored the mesh id anyway.
The stale id defeats the geom_dataid == -1 early-out in mjc_PlaneConvex, which then walks the fitting mesh and can emit up to 3 contacts into a buffer that mj_maxContact sized at 1 for a plane-ellipsoid pair: SIGSEGV, or the driver's own contact-count check firing. Saving and reloading the same model produced a correct geom_dataid of -1, so the two paths disagreed.
Gate the assignment on the geom type, matching the guard used elsewhere in the compiler (user_model.cc:5317). Fitted primitives now also render as primitives: texture repeat is no longer divided by geom size, and mjVIS_MESHBVH no longer draws the fitting mesh's bounding volumes on them.