Jump to content

Universal camera


Recommended Posts

Hi all,

I am using new UniversalCamera to allow access of application web from pc or mobile devices. However It doesnt work so good. I have been testing  example of @davrous and It is perfect!. Maybe I need to reprograme some tips of this camera. Now I can only turn camera in my tablet but i cant move. The version of BabylonJS that I am using is v 2.6 alpha

Params of my camera:

        var camera = new BABYLON.UniversalCamera("universalCamera", new BABYLON.Vector3(600, 200, -500), scene);
        camera.setTarget(new BABYLON.Vector3(0,0,0));
        camera.speed = 5;
        camera.checkCollisions = true;
        camera.ellipsoid = new BABYLON.Vector3(2, 3, 2);

Thanks you very much!!!

Link to comment
Share on other sites

Yes of course I render all my scene. If I drag my finger over screen of tablet and  I only can turn but never move. At the same device I have tested this demo  babylonjs.com/demos/sponza/ uploaded by @Deltakosh and @davrous and it works perfectly I only have created the camera that appears in my last post and it hasn't the same  behavior what am I doing bad...

Link to comment
Share on other sites


You're still using handjs. We decided, after an agreement with the jQuery foundation, to switch to their polyfill jQuery PEP: https://github.com/jquery/PEP.

Try the following in your sample:

1 - Reference jQuery PEP before babylon.js: https://code.jquery.com/pep/0.4.1/pep.js
2 - Add this attribute to your rendering canvas touch-action="none"

It should work with the UniversalCamera. 


Link to comment
Share on other sites

You must remove reference to hand.js (you still have it in your script references) to avoid collision and for the canvas, you have to add the touch-action property as an attribute to the HTML element not via styling/css. 

You can view an exemple in the jQuery PEP documentation or reading the code of page of sponza.

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...