ArcRotateCamera vs UniversalCamera

Hi there,
i’m developing a warehouse 3D scene and i had started with an ArcRotateCamera pointing on the origin.
All work fine till the user doesn’ decide to navigate closer. Moving the camera with mouse wheel, when the camera reaches and pass the origin the view is flipped back keeping the view on the origin.
Ok this is the normal behaviur of ArcRotateCamera but…is it possible to avoid that?
The alternative seems to use an Univeral Camera but i really like all the features that comes with an arcRotateCamera (panning, zoom, etc.). With the Universal Camera, if i understand, i have to program it by myself.

I link a simple PG to better exaplin what i need to achieve:
If you try to navigate with mouse in one of the lanes, when you pass the origin the view is flipped back.

Any idea?
Thank you in advance.

Hello you can limit the camera radius with: camera.lowerRadiusLimit = 1

1 Like

I tryied that parameter, but in this way the camera stops when it reaches 1 step to the target. I’d like it will be possible to go beyond the target avoiding the flip.

So set it to 0.0001

Check if camera.radius is less then some value, then move towards camera.direction.
I am not sure how to get camera.direction though.

It pass through the target but it is blocked after some step. Forthermore, if i zoom in with mouse wheel to the target it gets blocked then i use pan for increasing the dstance from target (right mouse click and drag the cam) when i try to use the zoom again is still blocked, even if i’m far from the target.

I tryied something similar in this PG: (only a test on z-axis). When i approach the target i chage its position.z of 3 steps. But it seems non to work as expeted. Forthermore, as you sayd, it is very difficult to cacth camera direction.

I think i’ve to use an UniversalCamera :frowning:

Adding @PolygonalSun who is playing a lot with inputs and camera at the moment :slight_smile:

Lemme take a look and see what’s going on


Maybe i’ve found the right compromise for my application using ArcRotateCamera.
I’ve inserted two hided planes the sorround my scene and i set the target behind these planes.
Enabling collisions with those planes the camera can’t never reach the target and seems is possible to navigate the warehouse.

Do you think could it work?

I reply to myself: it works!!! :slight_smile:

But now i’ve another question, hopefully the last one: is it possible to change the rotation center without changing the target? With the solution described above, now i can navigate the warehouse but the target is quite far form the camera and when i rotate the camera the radius is too big.
I’d like to change the center of the rotation to a more closer point, keeping the target at the same place.

I like the idea but it is unfortunately not supported and you might need to roll out your own camera. @PolygonalSun might have some tricks ?

1 Like

Well did you try to change the value of lowerRadiusLimit ? The goal is to set it to the right value so the radius stops right before the target

Also change camera.minZ to avoid near clip plane

That will probably requires to use an Universal Camera

1 Like

If I’m understanding right, you want to be able to dynamically change the center of your rotation without having to change the actual camera target, is that correct? If so, would this mean that your camera would rotate with the new point but possible be off-center? I just want to make sure that I understand what you’re looking for so that I can advise you properly.

If so, I’m inclined to agree with @Deltakosh and @sebavan that there’s no built-in way to do it but the UniversalCamera is would give you a good base and you could either make custom camera inputs or use scene.onPointerObservable to capture inputs and manually change the camera.

1 Like

HI @PolygonalSun,
yes, that was my intent, but in the meanwhile i’ve found another solution that maybe could be more suitable for my application. I don’t know if continue on this post or open a new one: anyway this is how i’m planning to do.

I use ArcRotateCamera with locketTarget and than i move the target. This could be useful to make animation moving from a mesh to another.
All work fine but in this way i loose the pan feature (right click and drag). So i implement a scene.onPointerObservable to capture inputs and manually change the right click behaviur.
I made something like @PolygonalSun suggested in this post How to change UniversalCamera behaviour

It works but, as i mentioned in that post too, when i try panning, after some moves the scene goes far away: it seems that x,y mouse coord increase with very big value: and i don’t understant why. I tryied also with debug ad all i can see is that at certain point the coords increase to very big values.

This is my PG:
Try make some panning.

Thank you in advance

What i’ve previuosly wrote happen yesterday on my Smart Working position: we connects to our office PC with an RDP. Is it possibile that RDP slow down the connection and that the cause of what i was facing?
I’ve tryed now (today i’m in my office) and seems to work fine.

Can you give me a feedback? It works fine also for you?
Thank yuo guys.