Jump to content

Check Visibility PointerOver Action


RelaX
 Share

Recommended Posts

Hi,

I woulk like to check if a Mesh is visible before an action ist triggered.

 

What I don't want: http://www.babylonjs-playground.com/?17

 

My best attempt so far is this:

var underPointer = new BABYLON.PredicateCondition(mesh.actionManager, function () {    return scene.pick(scene.pointerX, scene.pointerY).pickedMesh === mesh;});mesh.actionManager.registerAction(new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, mesh.material, "emissiveColor", BABYLON.Color3.White(), underPointer));

And setting isPickable for everything that could be in the "way" to true.

http://www.babylonjs-playground.com/#2DKQZC

 

It doesn't look great, because the cursor ist still changing and it's not working correct when the condition fails and you move the pointer over the mesh to a position with true condition, because the trigger won't fire again.

 

Is there no better way to do this?

 

brgds

Link to comment
Share on other sites

I don't have a solution but I made it even a bit more obvious: http://www.babylonjs-playground.com/#2DKQZC#2

 

The cursor transforms to a pointer even if you hover over the part of the mesh that is underneath the plane. I assume that RelaX only wants to transform the pointer when hovering over the top part (just like the actual action triggers work). Am I right?

Link to comment
Share on other sites

That's one goal I would like to achieve, more important is the fact that OnPointerOverTrigger isn't triggered after it was triggered the first time, without leaving the mesh again.

 

For better understanding:

  1. move the pointer to a position where the sphere is covered (cursor changes)
  2. now move the pointer to a position where the sphere isn't covered

So I need a way to reset the PointerOver trigger, is that possible? And would it work without resulting in bad performance?

 

brgds

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...