3Dlove Posted October 14, 2015 Share Posted October 14, 2015 Hello guys, I try to simulate a mouse click with jQuery : I can catch the event with jQuery but Babylonjs doesn't catch it with scene.onPointerDown Here is my code :var x_coord = 918, y_coord = 549;window.myevent = $.Event( "mousedown", { pageX: x_coord, pageY: y_coord } );$(scene._engine.getRenderingCanvas()).trigger(myevent); Any ideas ? Have a nice day ;-) Quote Link to comment Share on other sites More sharing options...
3Dlove Posted October 15, 2015 Author Share Posted October 15, 2015 Here is the solution:var x= 918, y= 549;var element = scene._engine.getRenderingCanvas();var clickEvent = document.createEvent("MouseEvents");clickEvent.initMouseEvent("mousedown", true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);element.dispatchEvent(clickEvent); DisAccIsJustForUrAnswerTy! and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 15, 2015 Share Posted October 15, 2015 https://github.com/BabylonJSX/Native-JS-Events jerome 1 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.