RelaX Posted August 12, 2015 Share Posted August 12, 2015 Hi,there are these triggers reacting to clicks/touchs: OnPickUpTrigger = mouseupOnPickTrigger = mousedownOnLeftPickTrigger = mousedown for specific clickOnRightPickTrigger = mousedown for specific clickOnCenterPickTrigger = mousedown for specific clickBut 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 12, 2015 Share Posted August 12, 2015 Hey you can use scene.getMeshUnderPointer() to improve your solution Quote Link to comment Share on other sites More sharing options...
RelaX Posted August 13, 2015 Author Share Posted August 13, 2015 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 bescene.onPointerDown = function (evt, pickResult) { meshUnder = scene.getMeshUnderPointer();};an improvement? brgds Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 13, 2015 Share Posted August 13, 2015 It's only scene.meshUnderPointer: http://doc.babylonjs.com/classes/2.1/Scene#meshunderpointer-abstractmesh-classes-abstractmesh- Quote Link to comment Share on other sites More sharing options...
RelaX Posted August 13, 2015 Author Share Posted August 13, 2015 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. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 13, 2015 Share Posted August 13, 2015 Correct! 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.