AB4D Forum

Full Version: how to reset mouse or camera control changes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a bunch of boxes which i programatically select, and move my _targetPositionCamera to focus on using this line of code: 

        _targetPositionCamera.MoveTargetPositionTo(obox.CenterPosition, 1000)

It works really well and the animation helps the user understand where they are jumping to.

However when the user manually scrolls the view left or right using the mouse or the control panel, the line of code above doesn't bring the selected box into view because the control panel or mouse has shifted the focus so its no longer central. 

There is no " .MoveTargetPositionTo" on the mouse and control panel cameras. how do I reset them to align with the  _targetPositionCamera?

Note: In my constructor I have assigned:
 _cameraControlPanel.TargetCamera = _targetPositionCamera        
_mouseCameraController.TargetCamera = _targetPositionCamera
Each camera also has an Offset property that is changed when the camera is moved - it also changes the actual target position.

To fix your problem, before calling "MoveTargetPositionTo" add Offset to TargetPosition and reset the Offset:

_targetPositionCamera.TargetPosition += _targetPositionCamera.Offset;
_targetPositionCamera.Offset = new Vector3D(0, 0, 0);