Example #1
0
        //============================================================
        public void Update()
        {
            Vector3 position = new Vector3(_position.X, _position.Y, _position.Z);
            Vector3 target   = new Vector3(_target.X, _target.Y, _target.Z);

            _matrix.AssignNative(DxMatrix.LookAtLH(position, target, Vector3.UnitY));
        }
Example #2
0
        //============================================================
        // <T>向上/向下旋转</T>
        //
        // @param angle 角度
        //============================================================
        public void DoPitch(float angle)
        {
            SFloatVector3 axis   = new SFloatVector3();
            SFloatVector3 axisUp = new SFloatVector3(0, 1, 0);

            axisUp.Cross(_direction, axis);
            DxMatrix      dxMatrix  = DxMatrix.RotationAxis(new Vector3(axis.X, axis.Y, axis.Z), angle);
            SFloatVector3 direction = new SFloatVector3();
            // 旋转Y轴
            SDxMatrix matrix = new SDxMatrix();

            matrix.AssignNative(dxMatrix);
            matrix.UpdateData();
            matrix.Transform3x3Vector3(direction, _direction);
            // 旋转方向
            direction.Normalize();
            _direction.Assign(direction);
            UpdateTarget();
        }