Draggable Isometric Camera

Brand new to this, just playing around. I would like to know what strategy to employ to implement a draggable isometric POV.

For example, like the following:

Except rather than having a character that the camera is pointed toward, it would just be pointed to an arbitrary point, and I would be able to move the camera by dragging the ground around. The angle of the camera would be consistent.

Hello and welcome!

Form the playground you mentioned, instead of having camera.lockedTarget = player you can just set camera.lockedTarget = anyVector3ThatYouWant

Then you can register to scene.onPointerObservable to get an event when a pointerdown or move is triggered and the use that to move your vector3

Or you can also create a dummy box (set to mesh.isVisible=false) and then move that mesh

Thank you for pointing me in the right direction.

I combined it with the scene.onPointerObservable example here: Babylon.js Playground

Unfortunately, the camera keeps jumping between two points. Is this because the movement of the camera is changing where the “pick” value hits?



I think this is because the camera move so the ground position is different and thus it is not a reference point anymore.
Does it make sense?

Yes, that’s what I suspected. Is there a way to move the scene itself instead of the camera? Or would you propose another strategy?

I would recommend using an adapted strategy:

  • Pick the ground to get the initial point
  • At first move event pick the ground again to get the offset and then use mouse coordinates only to move (e.g. do not pick anymore but just use the mouse delta values)

To move the scene you only need a root node (to parent all meshes to it) and then just move that root node