I ask this for making my default ground mesh, with its grid material, not getting in the way when a user tries to click a model to move, scale, or rotate it by default.
So in general,
How to make a mesh irresponsive to transforms?
I ask this for making my default ground mesh, with its grid material, not getting in the way when a user tries to click a model to move, scale, or rotate it by default.
So in general,
How to make a mesh irresponsive to transforms?
Hey,
do you mean transform because of gizmos? or because of picking?
You can flag a mesh to mesh.isPickable = false
in that case
I think I don’t know the difference
Let me know if the isPickable is enough then Else please provide a playground repro so I can see what you need
Thanks a lot
I will try it
I can guess now. I haven’t find the oppurtunity to try it, on mobile and no access my computer, but to use transforms (gizmos) one should first pick the mesh then use gizmos.
So I need to disavle picking as your latter suggestion.
To gain more knowledge how to disable particular trannsform/s or gizmo/s for a picked mesh that normally have them?
The gizmo can define which transform is available: Use Gizmos (eg. Drag arrow, Bounding box) - Babylon.js Documentation
I am trying to put a default ground for every scene though I do not want it to be pickable when clicked because when I want to click a model I do not want to click and pick the ground by mistake, same for transforms.
I do the following with isPickable = false
yet still it is pickable when picking mode is enabled?
What am I missing?
var ground = MeshBuilder.CreateeGround("hn-default-ground-mesh", {width: 60, height: 60, subdivisions: 2}, scene)
ground.isPickable = false
ground.doNotSerialize = true
var gridMaterial = new GridMaterial("hn-default-grid-material", scene)
gridMaterial.backFaceCulling = false
gridMaterial.opacity = 0.75
gridMaterial.gridRatio = 1 // The scale of the grid compared to unit.
ground.material = gridMaterial
I also want to eclude the meshes grid material from any kind of user interaction if it can ever interact.
Also is there something like nonAttachableMeshes or a robust way to achieve it, opposite of gizmoManager.attachableMeshes
Maybe?
let attachableMeshes = scene.meshes.filter(mesh => !nonAttachableMeshNameCriteria.test(mesh.name))
gizmoManager.attachableMeshes = attachableMeshes
If you are using the inspector, it will ignore the isPickable state
If you are using the GizmoManager (it could really be useful to get a repro as I have still no clue on what you are doing/using), you can turn off the automatic picking with manager.usePointerToAttachGizmos = false
and then manually call manager.attachMesh()
when you need it
Actually I have to use the inspector for my use case. Here is a PG for how I create my default ground I need to be non pickable by click, non gizmo attachable or non transoformable.
If you use the inspector this is not an option unfortunately
Ok, no problem.
Is there a way to keep a meshe’s transform values unchanged although the transformations applied by a gizmo?
You could parent it to another mesh which would be the one changed by the guizmo ?
I need more light.
Also is there something like non mesh ground if a non mesh thing is not affected by transformations?
every meshes are affected by transforms you can not prevent that it might be easier to disable the ground when the inspector is open and re enable it later on ???
Actually there is a Render Grid which seems as a perfect fit for my use case if I can exclude it from exports. I was trying to emulate that by adding a mesh and a grid material on it. I wanted to make it non pickable and non transformable with gizmos.
However I get errors when ı click this in my app:
Uncaught TypeError: Cannot read property 'ShadersStore' of undefined
I have made a dedicated topic for it here.