Jump to content

Calculating ArcCamera direction

Robbie Lewis

Recommended Posts

Hey guys,

This is my first Babylon.js project, really enjoying it so far! I've found answers to all my questions on this great forum, except for one.

I've created a 5x5x5 grid using lines and I'm placing blocks within the space using a cursor. I'm using an ArcRotateCamera to pan around the grid. I'm using the num pad arrows to move the cursor around within the 3d grid and insert/delete to add/remove blocks. See image attached if it helps.

The problem is, when I rotate 180 degrees around my grid, the left num pad arrow now moves the block right from the cameras perspective. What I need to do is calculate the direction the ArcRotateCamera is facing and affect the cursor accordingly. I have experimented with the Alpha property of the camera, but the numbers it gives make no sense! A full rotation of the ArcRotateCamera gives a value of around 6.25. This confuses me, I would expect the alpha to be in degrees?

How can I calculate the direction the camera is facing? (I only care about the alpha plane for this particular problem)


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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...