Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created December 9, 2023 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/cfea6d6e3e789579319debc846035629 to your computer and use it in GitHub Desktop.
Save flushpot1125/cfea6d6e3e789579319debc846035629 to your computer and use it in GitHub Desktop.
// wrap in bounding box mesh to avoid picking perf hit
var gltfMesh = container.meshes[0]
var boundingBox = BABYLON.BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox(gltfMesh)
// Create bounding box gizmo
var utilLayer = new BABYLON.UtilityLayerRenderer(scene)
utilLayer.utilityLayerScene.autoClearDepthAndStencil = false;
var gizmo = new BABYLON.BoundingBoxGizmo(BABYLON.Color3.FromHexString("#0984e3"), utilLayer)
gizmo.attachedMesh = boundingBox;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment