juanmajr93 Posted January 29, 2017 Share Posted January 29, 2017 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); camera.attachControl(canvas); Thanks you very much!!! Quote Link to comment Share on other sites More sharing options...
Hagop Posted January 29, 2017 Share Posted January 29, 2017 Are you sure you are rendering the scene? Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 29, 2017 Author Share Posted January 29, 2017 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... Quote Link to comment Share on other sites More sharing options...
hunts Posted January 29, 2017 Share Posted January 29, 2017 @juanmajr93 Do you have any object blocking the camera path forward? since the camera collision is enabled Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 30, 2017 Author Share Posted January 30, 2017 Hi @hunts no I think that there aren't any object with can block the movement of camera. Well the only way that you could test it is sharing my scene. Please test it using chrome with mobile device and you will detect the problem Thanks! Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2017 Share Posted January 30, 2017 Hi, 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. David Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 30, 2017 Author Share Posted January 30, 2017 Hi @davrous I have made this changes and It doesn't work. After I added JQueryPEP file to my project my camera didn't turn and move... I have added touch-action property to style of canvas and nothing... Maybe, you see again imported files and check if they are correct Thanks! Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2017 Share Posted January 30, 2017 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. Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 31, 2017 Author Share Posted January 31, 2017 yeah! it is pefect now!!! Quote Link to comment Share on other sites More sharing options...
winkman Posted January 31, 2017 Share Posted January 31, 2017 Hi, is the swich to PEP for all cameras or only UniversalCamera ? - as hand.js is still mentioned in the documentation / tutorialsf for eg. ArcRotateCamera. http://doc.babylonjs.com/tutorials/cameras http://doc.babylonjs.com/classes/2.5/arcrotatecamera 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.