It could be great to have another boolean called for instance IgnoreOrigin on the pickWithRay and multipickwithRay functions to prevent hit on the origin of the ray when the origin is on a mesh that is already pickable. And I wonder if it could not be great to assign this boolean to true by default.
A ray doesn’t know its node origin, only its origin position. Unless I am missing something, this is not just a flag. Want to explain the use case with some code? This would be really great
You’re right but when you pick points, you should be able to exclude the known origin of the ray if this origin is already on the surface of a pickable mesh.
but the data is not present at the time of generating the ray. you know this information, babylon has no way of knowing it. You can write a predicate to prevent the ray from selecting the mesh you are generating the ray from.
If you think I misunderstand (which happen more often that i’d like to admit), code example would be great!
so - a ray is a mathematical concept. It has an origin, which is a vector3, and a direction, another vector3. Along the way it will hit objects defined by the scene. To control these you have a few options - you can define a predicate when running the function to choose which meshes the scene should select from, or you could set the origin mesh to be not pickable for the duration of the test. This is on you as a dev, as babylon doesnt know the origin of the generated ray.
Yep, that would be the best solution here.
There are different ways of solving this, but the predicate is the simplest one. An even better predicate, if possible, would be to check against the list of meshes you DO want to hit, especially if your scene has a lot of unrelated meshes.