Jump to content

Detect the device to change camera


juanmajr93
 Share

Recommended Posts

Hi all,

I want change between differents camera depends on the devices. I am developing an aplicaton web in BabylonJS and I must to define FPSCamera and TouchCamera. When this web is loaded at mobile device I have to activate the touch camera and if I visit it from pc I use FPSCamera. Do you know the way to manage it?

 

Thanks!

Link to comment
Share on other sites

Hello,

Use our UniversalCamera. It works on touch on mobile, with a gamepad on Xbox/PC and using keyboard/mouse on a PC: http://doc.babylonjs.com/tutorials/Cameras . All our demos on http://www.babylonjs.com are using it now. For instance, Retail: http://www.babylonjs.com/demos/retail works on touch on iPhone/Android, keyboard & mouse on PC/Mac and gamepad on Xbox One. 

You then have nothing else to do. Isn't that cool? ;)

David

Link to comment
Share on other sites

Hi all,

@davrous

I have tested UniversalCamera and TouchCamera with hand.js file imported. Well, both show me the same behaviour like freeCamera on PC. However the problems appear when I use an iPad to visit my application web. I cant move fast arround scene and I cant turn camera in X edge so i only move foward and back but I cant change direcction to move up or down...     

this is my code:

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

You can probe this in this link: http://150.214.174.25:8029/subsuelo/

I hope your answers, thanks.

Link to comment
Share on other sites

hi @hunts yes I have changed speed of camera but I dont resolve problems in mobile device. Do you test this type of camera in iPad or others, I can only turn camera but I cant move arround scene. Do you know the reason? I have imported BabylonJS file from this source:

https://cdn.rawgit.com/BabylonJS/Babylon.js/master/dist/preview release/babylon.js

 

 

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