Jump to content

FreeCamera vs ArcRotateCamera on mobile device


3Dlove
 Share

Recommended Posts

Hello guys,

 

I've done something with FreeCamera on desktop,

but FreeCamera doesn't work with touch on mobile device :(

 

So I tried use an ArcRotateCamera but I believe that I can't change the inertia for my movement :

 

Here is my code :

 

 

With FreeCamera

var camera = new BABYLON.FreeCamera("freeCam", new BABYLON.Vector3(0, 2, -10), scene);camera.applyGravity = true;camera.checkCollisions = true;camera.inertia = 0.8;scene.activeCamera = camera;camera.attachControl(canvas);
var move = 2$("#leftButton img").click(function() { 	var translation = new BABYLON.Vector3(-move,0,0);	translation = BABYLON.Vector3.TransformNormal(translation, scene.activeCamera.getWorldMatrix());		scene.activeCamera.cameraDirection = translation;});

That works well on desktop only.

 

 

With ArcRotateCamera :

var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene);camera.checkCollisions = true;camera.setPosition(new BABYLON.Vector3(0, 2, -20));camera.lowerRadiusLimit = camera.radius;camera.upperRadiusLimit = camera.radius;camera.inertia = 0.8;scene.activeCamera = camera;camera.attachControl(canvas);
var move = 2;$("#leftButton img").click(function() { 	var translation = new BABYLON.Vector3(-move,0,0);	translation = BABYLON.Vector3.TransformNormal(translation, scene.activeCamera.getWorldMatrix());		translation.y = 0;	scene.activeCamera.target.addInPlace(translation);});

How to use FreeCamera with touch on mobile device ?

or how to change the inertia of the deplacement with "target.addInPlace(translation)" with ArcRotateCamera ?

 

If it's possible, I prefer FreeCamera on mobile solution =)

 

Thanks for your help

Link to comment
Share on other sites

Hello,

 

I knew TouchCamera but I would like to move orientation camera vertically and horizontaly like with freeCamera.

But touchCamera do only horizontaly orientation, and if we slide vertically, we move the camera (translation, not rotation).

 

I've added 4 buttons to move on the scene =)

Link to comment
Share on other sites

  • 5 months later...

Hello.

Have you tried to put a far target (or play with target position) so your movement will seem like a plane?

Edit: I refer to the use of ArcRotateCamera with a far target. A sphere with a huge radius becomes a plane. So your movement would be like a plane instead of like a sphere. I'll give it a try.

Greetings

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