heavymetalmonk Posted December 21, 2015 Share Posted December 21, 2015 I'm trying to move meshes using on screen buttons shaped like arrows. In the default view, the right arrow pushes the mesh to the right side of the screen and so on. But when the camera is moved, using the arrows is a bit confusing. For example, pressing right moves the mesh to its right, but towards the screen's top edge. I'm using mesh.translate(new BABYLON.Vector3(10, 0, 0), 1, BABYLON.Space.LOCAL); for the translation. So, is it possible to move the local axes with the camera, so that whatever I do with the camera, pressing the right arrow button (on-screen) pushes the mesh towards the right edge of the screen only. Or is there any other way to achieve this? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 21, 2015 Share Posted December 21, 2015 Hello, you have to evaluate your direction according to camera's local space. This is exactly what the camera does for its own movement:https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.freeCamera.ts#L248 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.