Jump to content

[solved] Direct Camera manipulation for rotation/direction


Recommended Posts


I have an ECS engine and want to keep the camera, input, and entities separate.  In this case the GameCamera is a system that is assigned an entity to read it's position and direction from and update the BabylonJS camera with.  I already have a working Controller system that attaches to the scene's `onKeyboardObservable` and I am going to use the `onPointerObservable` for mouse movement.

However I don't see how to set the `Camera` view direction, only it's position.  Is there no simple way to either specify a normal vector3 for direction or a rotation radian and an up vector? I don't see anything in the documentation or in the source, what am I missing?


Link to comment
Share on other sites

Thanks for the help, the TargetCamera and setTarget did the trick but I am running into a new issue.

My Camera position is outside of a box, however when I turn the camera around, the camera cuts through the box and due to back culling everything disappears. I made a room by placing 1x1x1 cubes in a grid, 5x5 with the middle 2x2 open space. If I move the camera close to a box or into the corners of the room the camera cuts through the boxes.  But the position of the camera is still outside of the box space.

Here is a gif of the effect:

How can I determine if the viewport? is going to cut into a box and keep myself from getting that close? Thanks!

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