[SOLVED] Lemur PickEventSession question

Hi guys

I have two nodes, node A and node B. Node A has a Lemur CursorEventControl added to it.

Now if I click on a geometry that is a child of node B, and behind that geometry, there is another geometry that is a child of node A then the CursorEventControl on node A will be notified.

As you can see here:

PickEventSession will try to iterate through all collision results until it finds one that has a CursorEventControl on it (or it’s parents).

One ugly solution is to add an empty CursorEventControl to node B to prevent this behavior. Another solution is to attach A and B into another node and attach “CursorEventControl” to the parent but… you know… ah…

I guess a better and cheap solution is to also send the index of collision result inside AbstractCursorEvent so one can check the index and if it is > 0 then ignore it if he wants.

@pspeed any thought?

Yeah, Lemur makes no judgment call on other geometry… it might be tree leaves or a clear window pane. It can’t know that you want some piece of geometry to block other clicks.

I think if you put a listener on some shared root that it will also get the pick for the unlistening node instead of the child.

Else the collision result has the geometry that was hit so you can also see if it was the same one (or in the hierarchy of) the one you added the listener to.

Hmm, but yet I can not tell from the CollisionResult if that is the first hit in the CollisionResults or not. That’s why I proposed to send the index as well.

Mmm… I just feel like if we’re down to using the index then something else is broken.

I’m not opposed… i just feel like out of context it’s rather cryptic information and a slide in a potentially wrong direction. (Next would be to include all of the collision results, for example.)

Can you describe your actual situation in not “This imaginary platonic solid A and this is imaginary platonic solid B” terms? Like what actually are these things?

Edit: because for example, a raw index will not help you skip clear or semi-transparent objects.

1 Like

Oops!!
Do you mean about different buckets?

Yes.

I have 3 main nodes in my scene editor.

private Node terrainNode = new Node("Terrain");
private Node plotNode = new Node("Plot");
private Node entitiesNode = new Node("Entities");

“Terrain” node contains chunks and block geometries. (Voxel terrain)

“Plot” node contains all plotted objects by plotters (trees, walls, fences…)

“Entities” node holds models for NPCs, houses, …

I have added a CursorEventControl to “Terrian” node to detect mouse clicks on terrain and add some stuff on the clicked location.

But if I click on a tree which is inside the “Plot” or on a house which is inside “Entities” node then CursorEventControl on “Terrain” node will be notified and I do not want it to happen or at least I know that hit is not the first hit so I can skip it.

Probably a stupid solution, but what if you add a CursorControl or MouseControl to the node holding the objects in front and consume the event?

I guess you need some sort of ‘blocking’ geometry if you want the tree/house/… to consume the click.

I think that’s also the way Paul handles popup’s in Lemur. A blocking geometry that consumes clicks outside the popup.

1 Like

Yes, probably going to do it, I can add a CursorEventControl to the “Plot” node and “Entities” node to consume the event.

I was thinking having the collision index might be a better idea to resolve the issue but it seems the raw index might not help in some cases.

No, I mean that index > 0 will just tell you if the object is not the first collision. It won’t tell you that it’s the first visible collision. Only your scene knows that.

If you add a listener to the root Plot node and the root Entities node then it should solve your problem.

1 Like