MasterK Posted November 16, 2015 Share Posted November 16, 2015 Virtual Joystick's canvas cover the renderCanvas and scene can't listener mouseEvent... also the GUI button can't use. I want to add a virtual joystick to my game and control the character move. Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 this._leftjoystick = new BABYLON.MyVirtualJoystick(true);this._leftjoystick.setAxisForUpDown(BABYLON.JoystickAxis.Z);this._leftjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.X);this._leftjoystick.setJoystickSensibility(0.15); i just add these code. when i open it with my iphone6, touches is no reaction... the control circle doesn't appear...And it can't be test on PC. Quote Link to comment Share on other sites More sharing options...
davrous Posted November 16, 2015 Share Posted November 16, 2015 You need to add a reference to jQuery PEP to have touch support on all platforms. I was using hand.js in the past.David Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 18, 2015 Author Share Posted November 18, 2015 You need to add a reference to jQuery PEP to have touch support on all platforms. I was using hand.js in the past.David Is there sample code?? so i should both add reference jquery and jquery.pep? but i dont use other jquery function...the pep may be more used in html element... is it fitable for babylon? and can i make virtualJoyStick easyly??? Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 18, 2015 Author Share Posted November 18, 2015 i can use hand.js. not consider about other. the second question...when the virtual stick's canvas take control of pointer event, the renderCanvas can't receive pointer event... What's the good way to solve this? Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 18, 2015 Author Share Posted November 18, 2015 i can use VirtualJoystick.prototype.setActionOnTouch(action) to solve my problem... not very proper... Quote Link to comment Share on other sites More sharing options...
davrous Posted November 18, 2015 Share Posted November 18, 2015 You just need to use jQuery PEP polyfill: https://github.com/jquery/PEP we're now using it by default in the Virtual Joystick code and on our website: babylonjs.com . No need for jQuery itself. It hasn't change the way to use our sample code.I'm adding a full screen 2d canvas on top of the rendering canvas to catch pointer events on it. Can't see how I can do in another way. You can register other events on it if you need to.What are you trying to do exactly?David eps 1 Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 18, 2015 Author Share Posted November 18, 2015 that's nice. i'll try...(pep) yeah, i see the virtualJoystick code and the full screen 2d canvas's zIndex = 5. so the scene.onPoinerDown = function(){ ....} is invalid. I was wondering if there any way to transfer the 2d canvas's event to the canvas behind , not swallow it. may be the event module should be reinforced. like the cocos2d-x i used. Because the bjs is best choice for game... (don't blame me on the grammer..) 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.