protected Matrix _view; // The view matrix. #endregion Fields #region Constructors public Camera(Game game) : base(game) { _game = game; _targetSpecified = false; _target = null; _posOffset = Vector3.Zero; _inCutscene = false; _cutData = null; ResetCamera(); _controlOverride = false; }
public Camera(Game game, Vector3 pos, Vector3 targetPos, Vector3 up) : base(game, pos) { _game = game; _targetPos = targetPos; _up = up; _target = null; _targetSpecified = false; _posOffset = Vector3.Zero; _inCutscene = false; _cutData = null; SetProjection(); _controlOverride = false; }
/// <summary> /// Re-calculate the view matrix. /// </summary> protected virtual void UpdateViewMatrix(GameTime g) { if (_cutData != null) { if (_cutData.Update(g)) { _target = _cutData.OriginalTarget; _pos = _cutData.OriginalPosition; _posOffset = _cutData.OriginalOffset; _cutData.EndFunction(); _cutData = null; _inCutscene = false; } else _view = Matrix.CreateLookAt(_pos + _posOffset, _cutData.Target.TranslationM.Translation, Up); //_cutData.Target.TranslationM.Translation, Up); } else if (_targetSpecified && _target != null) { _targetPos.Normalize(); _view = Matrix.CreateLookAt(_pos + _posOffset, _target.TransformationM.Translation, Up); } else { _targetPos.Normalize(); _view = Matrix.CreateLookAt(_pos + _posOffset, _targetPos + _pos, Up); } }
public void RunCutsceneLookAtTimed(GameObject obj, float time, Vector3 offset, EndCutsceneFunction func) { _cutData = new CutsceneData(obj, time, _target, _pos, _posOffset, func); _inCutscene = true; _target = obj; _posOffset = offset; _targetSpecified = true; }