Jump to content

Virtual Joystick's canvas cover the renderCanvas and scene can't listener mouseEvent


MasterK
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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