Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Changing the local axes of a mesh according to camera movement

$
0
0

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?


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>