Skip to content

Selective picking #452

@Eneroth3

Description

@Eneroth3

In the extension I'm working on we want to pick elements from the mouse position, limited to elements "belonging" to our extension. If other entities are in the way, we want them to be ignored and pick just straight through them as if they weren't there.

We are currently using a PickHelper as we want an entity with no inference, but to generalize, this kind of control could be very useful for InputPoint and maybe Model#raytest too.

Perhaps there could be a way to attach a callback to a PickHelper class, have an instance path yielded and return a boolean of whether this entity is a valid pick? If not, the ray could continue through it and the first entity behind be checked instead. In our case we could just compare the instance path to a hash of known objects we are interested in, but in other use cases for instance the type could be checked.

Another approach could be for Model#raytest to not just return the first intersection but an Array of all intersections. The typical work around here is to use sequential raytests until you find what you want, but that can be extremely slow in a live tool that needs to update with high FPS.

Maybe this method already needs to find all intersections internally before it can identify the first one along the ray. In such case method returning all intersections would be as fast as the current one returning just a single intersection. Maybe there is some kind of optimization here I don't know of, and the algorithm can test faces in the order they would occur along the line, and can stop when finding the first intersection. In such case a method returning all intersection would be significantly slower than the current method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions