Jump to content

Complete Click/Touch Action


RelaX
 Share

Recommended Posts

Hi,

there are these triggers reacting to clicks/touchs:

 

  • OnPickUpTrigger = mouseup
  • OnPickTrigger = mousedown
  • OnLeftPickTrigger = mousedown for specific click
  • OnRightPickTrigger = mousedown for specific click
  • OnCenterPickTrigger = mousedown for specific click

But there is no mousedown&mouseup event. I'm using the ArcRotateCamera and keep triggering buttons by mistake when I rotate the camera.

 

My workaround:

scene.onPointerDown = function (evt, pickResult) {    meshUnder = pickResult.pickedMesh;};scene.onPointerUp = function (evt, pickResult) {    meshUnder = null;};
var wasUnderPointer = new BABYLON.PredicateCondition(mesh.actionManager, function () {    return mesh === meshUnder;});mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickUpTrigger, function () {    // some Code}, wasUnderPointer));

It works, but isn't there a better way to achieve it?

 

brgds

Link to comment
Share on other sites

Hi,

I get this error: "TypeError: scene.getMeshUnderPointer is not a function" and it looks like there is no scene.getMeshUnderPointer, atleast it's not in the doc or in the playground.

 

Let's say scene has that method, in which way would be

scene.onPointerDown = function (evt, pickResult) {    meshUnder = scene.getMeshUnderPointer();};

an improvement?

 

brgds

Link to comment
Share on other sites

Thanks, but I still can't see the improvement, maybe he had this topic http://www.html5gamedevs.com/topic/16399-check-visibility-pointerover-action/ in mind, where it actually is an improvement.

 

Edit:

the returned mesh of scene.pick(scene.pointerX, scene.pointerY).pickedMesh and scene.meshUnderPointer aren't the same, I think scene.meshUnderPointer only considers mesh's with an actionmanager? Now I understand why it's an improvement.

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...