Overwrite the rotation of this transform in world space @param newRot the new rotation in world space */
| 182 | @param newRot the new rotation in world space |
| 183 | */ |
| 184 | inline void Transform::SetWorldRotation(const quaternion& newRot) { |
| 185 | if (!HasParent()) { |
| 186 | SetLocalRotation(newRot); |
| 187 | } |
| 188 | else { |
| 189 | //get world rotation |
| 190 | auto worldRot = GetWorldRotation(); |
| 191 | //get the relative world offset |
| 192 | auto relative = glm::inverse(worldRot) * newRot; |
| 193 | //apply the rotation |
| 194 | LocalRotateDelta(relative); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | Overwrite the scale of this object with a new scale |