public void ScenePanFocus(FScene scene, fCamera camera, Vector3f focusPoint, bool bAnimated) { CameraAnimator animator = camera.Animator(); if (bAnimated == false || animator == null) { // figure out the pan that we would apply to camera, then apply the delta to the scene Vector3f curPos = camera.GetPosition(); Vector3f curDir = camera.GetWorldFrame().Z; float fDist = Vector3.Dot((focusPoint - curPos), curDir); Vector3f newPos = focusPoint - fDist * curDir; Vector3f delta = curPos - newPos; scene.RootGameObject.Translate(delta, false); camera.SetTarget(focusPoint); } else { animator.PanFocus(focusPoint); } }
public void ScenePanFocus(FScene scene, fCamera camera, Vector3f focusPointW, bool bAnimated) { CameraAnimator animator = camera.Animator(); if (bAnimated == false || animator == null) { // figure out the pan that we would apply to camera, then apply the delta to the scene Vector3f camPosW = camera.GetPosition(); Vector3f camForward = camera.Forward(); float fDist = Vector3.Dot((focusPointW - camPosW), camForward); Vector3f newCamPosW = focusPointW - fDist * camForward; Vector3f delta = camPosW - newCamPosW; scene.RootGameObject.Translate(delta, false); camera.SetTarget(focusPointW + delta); } else { animator.PanFocus(focusPointW); } }
public void ScenePanFocus(FScene scene, Camera camera, Vector3 focusPoint, bool bAnimated) { CameraAnimator animator = camera.gameObject.GetComponent <CameraAnimator>(); if (bAnimated == false || animator == null) { // figure out the pan that we would apply to camera, then apply the delta to the scene Vector3 curPos = camera.transform.position; Vector3 curDir = camera.transform.forward; float fDist = Vector3.Dot((focusPoint - curPos), curDir); Vector3 newPos = focusPoint - fDist * curDir; Vector3 delta = curPos - newPos; scene.RootGameObject.transform.position += delta; camera.SetTarget(focusPoint); } else { animator.PanFocus(focusPoint); } }