示例#1
0
        /**
         *  @brief Rotates game object based on provided axis, angle of rotation and relative space.
         *
         *  If relative space is SELF then the game object will rotate based on its forward vector.
         **/
        public void Rotate(TSVector axis, FP angle, Space relativeTo)
        {
            TSQuaternion result = TSQuaternion.identity;

            if (relativeTo == Space.Self)
            {
                result = this.rotation * TSQuaternion.AngleAxis(angle, axis);
            }
            else
            {
                result = TSQuaternion.AngleAxis(angle, axis) * this.rotation;
            }

            result.Normalize();
            this.rotation = result;
        }