-----------------------------------------------------------------------
| 133 | |
| 134 | //----------------------------------------------------------------------- |
| 135 | void Node::rotate(const Quaternion& q, TransformSpace relativeTo) |
| 136 | { |
| 137 | // Normalize Quaternionernion to avoid drift |
| 138 | Quaternion qnorm = q; |
| 139 | qnorm.normalise(); |
| 140 | |
| 141 | switch (relativeTo) |
| 142 | { |
| 143 | case TransformSpace::AREN: |
| 144 | // Rotations are normally relative to local axes, transform up |
| 145 | m_orientation = qnorm * m_orientation; |
| 146 | break; |
| 147 | case TransformSpace::OBJECT: |
| 148 | // Rotations are normally relative to local axes, transform up |
| 149 | m_orientation = m_orientation * _getDerivedOrientation().inverse() * qnorm * _getDerivedOrientation(); |
| 150 | break; |
| 151 | case TransformSpace::LOCAL: |
| 152 | // Note the order of the mult, i.e. q comes after |
| 153 | m_orientation = m_orientation * qnorm; |
| 154 | break; |
| 155 | } |
| 156 | setDirty(); |
| 157 | } |
| 158 | |
| 159 | //----------------------------------------------------------------------- |
| 160 | //----------------------------------------------------------------------- |
no test coverage detected