Jump to content

pickInfo in Action callbacks params


paleRider
 Share

Recommended Posts

Hi everybody:

I have a doubt on registered Actions, is possible to retrieve the pickedPoint from the callback parameter?

I mean something like we have with Observables via the "d" param (d.pickInfo.pickePoint), in order to avoid to implement always the pick-result-check as shown in the following code (excerpt):

myMesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger,function(evt){
  var pickResult=scene.pick(scene.pointerX,scene.pointerY);
  if(pickResult.hit){
    ...
  }	
}));

Best regards.

Link to comment
Share on other sites

Hi again, PR.  Did you do a console.dir(pickResult) to see what cool properties are on that object?  I'm pretty sure that pickResult is a "pickingInfo"-class object.  Notice that it has a property named .pickedPoint, as well as a few other useful toys.  So, pickResult.pickedPoint should work for you.  Hope this helps.  Holler back, as wanted.  Mark thread as solved, if you're good-to-go.  :)  thx.

Link to comment
Share on other sites

Hi Wingnut, and thanks for your time:

Well I know Observable's constructor callback "data" parameter ("d" parameter if you prefer) exposes a pickerPoint property via pickInfo object, but my question or doubt is about availability of this same info from Actions without retrieving it through scene.pick(...).

Best regards.

Link to comment
Share on other sites

This should work :) (I use this sentence a little bit too often recently :))

So based on this:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L1331

You can see that the action is build with the pickedMesh, And if you dig further you will see that the event is actually stuffed with all you need:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Actions/babylon.actionManager.ts#L25

 

 

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