How to limit rotation

Jun 12, 2012 at 1:28 AM

I have a terrain model with objects on top and I'm trying to find a good way to prevent the user from rotaing the scene such that he can look underneath the terrrain model. It seemed like the best way would be to derive a new class from CameraController and override the OnManipulationDelta method, but unfortunately you cannot set the camera contoller in the HelixViewPort3D. At the moment I'm setting the RotationSensitivity to a low value when the camera Up vector approaches level, but that only kindof works. It's not ideal. Is there a better way?


Jun 15, 2012 at 4:38 AM

The CameraController is created in the control template of the HelixViewport3D, so you have to override the control template.

Or, use the Camera's Position and LookDirection coerce value callbacks, and enforce the Z values to to be positive and negative, respectively.

I have not tried this, but I think it should work.

Feb 26, 2013 at 9:11 AM
objo, could you please provide a simple example on how to do this? I guess limiting the rotation is quite a frequent requirement.
thank you very much!
Mar 13, 2013 at 6:12 AM