3Dlove Posted March 13, 2015 Share Posted March 13, 2015 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 FreeCameravar 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 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 13, 2015 Share Posted March 13, 2015 Hola, the TouchCamera (http://doc.babylonjs.com/page.php?p=24880) is a free camera for mobile devices. A bit more about it here - http://doc.babylonjs.com/page.php?p=22061 Quote Link to comment Share on other sites More sharing options...
3Dlove Posted March 13, 2015 Author Share Posted March 13, 2015 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 =) Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 13, 2015 Share Posted March 13, 2015 I think it's about the gesture position. Where on the screen do you trigger the gesture. I haven't thoroughly used a touch camera so I can't give pointers, but I do know that it is capable of everything a free camera can. Only with touch gestures :-) Quote Link to comment Share on other sites More sharing options...
Temechon Posted March 13, 2015 Share Posted March 13, 2015 Indeed, the Touch camera can only move forward and rotate. A FreeCamera for mobile does not exist right now. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 13, 2015 Share Posted March 13, 2015 What about the VirtualJoystickCamera in this case? Quote Link to comment Share on other sites More sharing options...
vbuendia Posted September 7, 2015 Share Posted September 7, 2015 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 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.