Pan at a specific position

Hey guys I’m new to Babylonjs. I’ve been playing around with the axis and so far I locked it where the camera is looking at the x,y plane. It starts at the center, so my question is, how do I pan the camera at start where the origin is close to the lower left of the screen instead of the center. I don’t want to move the target to the lower left as it would ruin the origin and the perfect x,y plane view. Here’s what I have so far Babylon.js Playground

Hi @jbcostan … sorry for slow replies.

Don’t be afraid to move the arc camera target. You can move it back to origin… easily, at any time… even animated with easing.

There is a FANCY playground… using buttons from our nice GUI 2d system.

First, look at lines 75-86. That is an arcCam target animator function. It can move an arcCam target ANYWHERE, ANYTIME, and at any speed.

Now scroll down thru all the button-making stuff… to lines 184-195. In THAT area, we set the ACTIONS of the top two buttons… to CALL that target-animator function mentioned above.

Click labeled buttons. No problems, right. We animate-move the arc camera .target quite nicely… setting it lower left, or returning it to origin… no worries.

Even if we “drag the arcCam target”…

  • by holding control-key while LEFT-MOUSE dragging
  • by using RIGHT-MOUSE dragging,

…the buttons and the animator function… rescue us just fine. Try some drag-targetting.

You could even use TWO (or more) cameras… one with .target set to lower left, and another with .target set to scene/model origin, and then use the buttons to switch cameras.

And, you don’t NEED to animate. The two buttons labeled unused… are lying. They are actually “actionized” to SNAP the target position (instantly)… (not animated). See lines 200 and 206… instant target moving… pure force. :slight_smile:

Lots of talking by me, but… main thing… don’t be afraid to move camera target or activate multiple cameras. YOU are the camera target commander… when using BabylonJS. Just give it Javascript orders, and it will obey. :slight_smile: Hope I have been helpful. Sorry for delay.


look who is here :))) @Wingnut

1 Like

Barely here. :confused: Thx for the likes… good to see you guys. Stay well and happy, friends.

1 Like

Thanks actually what I ended up doing was was move the target to the lower left set the upper/lower alpha/beta limit and set position back.