Confused by camera arc limits

I’m having a bit of trouble rationalizing the camera limits for ArcRotateCamera. Here’s an example of what I’m working with:

My goal is to ensure that no matter where a user rotates to they will never see the back of the frame. I especially like how the limits let you get to a deep angle (pretty much level).

I’m setting the lowerAlphaLimit and upperAlphaLimit. That lets me pull the frame up/down. I’m wondering if I can do the same thing to limit the longitude (or ensuring the right/left rotation) can actually move.

The action I’m trying to achieve is allowing rotation on the x/y but never letting them see the rear.

I’m also wondering if I could hook the camera action up to the mouse over. So if you mouse left/right without dragging you can perform the same action. This would be interesting because they you can just gently pan the camera without grabbing it.

I didn’t see anything in the docs for ArcRotateCamera. It would be nice to continue using it instead of implementing this as a custom camera.

@dbase, would something like this work for you?

1 Like

You can use scene.onPointerObservable:

1 Like

Yup you guys got it. I played with a few alpha and beta limits but confused the heck out of myself on that. The docs didn’t really help make it clear either. Ended up being very simple, luckily (thanks @gbz).

@Evgeni_Popov thanks for the pointer observable method. That works nicely, I see how you’ve mapped the cursor against the render dimensions. I’m going to add boundaries to it and soften the rotation. The interaction is rather harsh right now, going to find a way to soften it and have “bounce back” when outside the boundary.

Thank you both!

1 Like