Arc Rotate Camera Panning and animation

I have 2 issues, illustrated in the same Playground example.

Basically I have a setup where I have a globe. it’s origin is 0,0,0 when a user hits a button, I transform the Globe to a plane.

I ran into an issue where as the camera gets closer to (0,0,0), it slows down to a crawl. on another thread, it was explained this is how the camera works as it approaches the target.

this is an issue cuz when the globe is flattened around (0,0,0), the slowness comes into play as they attempt to get pan around.

To solve this, I project the plane up to the radius. that solves the slowness issue.

In globe form, i have code where if you click a mesh, I rotate the camera around to it, taken from some helpful other forum posts. works really well.

as a note: I had to set the camera UpVector to (0,0,1) in order to orient with the globe correctly.
I have no idea if that’s causing any issues in my current code, although I don’t think it should??

Issue 1:
however, when it’s over a plane, I don’t want to rotate it to the targeted mesh. i want to pan the camera. but I don’t want to just pan it. What I’d like to do, is preserve the viewing angle the camera is at, and slide it at a constant height above the plane to the center of the targeted mesh. so i guess it’s more of a “slide” than a pan, because all 3 values (x,y,z) have to change I’d imagine.

I have a playground where I move the camera, but it’s not right. I basically want to animate the camera until the target Vector (center of mesh) is in the center of the camera’s view, preserving its angle and height.

Issue 2:
When in plane mode, i want to the camera to be in a fixed “always up” position. the user can rotate vertically. I was able to set this. However, the panning and panning axis don’t seem to work. I want to constrain the user to pan along world x and y axis only, and not up and down. the mousewheel can do up and down, and it respects the upper/lower radius and collisions, so that’s good.

however it doesn’t seem to work? if you load the playground and then pan down, you’ll go below the plane. same in opposite direction.

Should I detach the Arc Rotate camera and switch to another type of camera (on the plane) that might be easier to configure? I kinda feel like that won’t really help, but maybe I’m wrong.


Hello do you mind providing a simpler pg for both issue? just focus on the problem and remove all unnecessary code :slight_smile:
It will help figuring out how to solve your issue

unsure what you mean.

the code is setting up the scenario i am doing. it’s the bare minimum i could setup to demonstrate the issue?

I created a version that is just for the panning control.

so on this one, i just need to setup the settings to make panning go along x,y only, and not travel along z.

the original PG shows the camera move issue I have.

I meant: I see no code related to camera animation or what you are doing with camera

ah. starting at line 94, i register for the Pick event. on pick, if its one of the boxes, i get the center of the mesh, and then scale that to the same height as the camera. this is my attempt to get the destination vector i want the camera to move to.

I feel the math on this is not quite right, because it ignores the angle the camera is at. but it works in my sphere mode.

Once i set the target (camtarget), the beforeRender loop starts trying to move the camera to that spot in an incremental way. so it isn’t an animation API call, it’s just many small steps, which happen smoothly and appear animated.

The basic idea is “where do i need to go? where am I now? move closer” repeat until I am there.

hum are you sure you share the right PG?

I updated both PGs slightly.

Animation Issue
This PG is more concerned with animating the camera while keeping the viewing angle the same, and staying at the same “height from the origin.” the angle and height part isn’t working, which is what i’m seeking help with. I changed the starting height a little to help.

Open the playground, and click the yellow cube. notice camera moves closer to it, but then changes the angle to look down.

Animation PG

Panning issue
Open this playground. I changed the starting height a little to make it obvious. right click and hold, and drag mouse down. this will pan in Z direction. but the panningAxis setting should prevent that, i thought? it doesnt. I basically want to pan on XY plane, and stop at the edges of the plane object, without going over. Also, when you pan down, you go through the mesh, which ignores the camera lowerRadiusLimit setting…

I suspect the lowerRadius and such is ignored because panning changes the target, so it probably comes into play somehow.

Panning PG

Panning issue
Well I think there is a misunderstanding maybe, we are Y up so setting the plane on XY makes you pan like in the demo


line 12 i set the upVector to be Z up. I have to do this for the globe, the coordinate system seems to expect that.

maybe I need to change normals on the meshes or something?

Oh ok…well I do not think that the camera will handle that for the panningPlane. I would rather encourage you yo either stay with Y up or then use the PanningPlane set to (1,0,1)