paleRider Posted August 28, 2017 Share Posted August 28, 2017 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 28, 2017 Share Posted August 28, 2017 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. Quote Link to comment Share on other sites More sharing options...
paleRider Posted August 28, 2017 Author Share Posted August 28, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 28, 2017 Share Posted August 28, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.