| 53 | } |
| 54 | |
| 55 | vector3 Transform::GetWorldPosition() |
| 56 | { |
| 57 | if (!HasParent()) { |
| 58 | return GetLocalPosition(); |
| 59 | } |
| 60 | |
| 61 | //the list of transformations to apply |
| 62 | list<matrix4> translations; |
| 63 | GetParentMatrixStack(translations); |
| 64 | |
| 65 | //apply all the transforms |
| 66 | matrix4 finalMatrix(1); |
| 67 | for (auto& transform : translations) { |
| 68 | finalMatrix *= transform; |
| 69 | } |
| 70 | finalMatrix *= GenerateLocalMatrix(); |
| 71 | |
| 72 | //finally apply the local matrix |
| 73 | return finalMatrix * vector4(GetLocalPosition(), 1); |
| 74 | } |
| 75 | |
| 76 | quaternion Transform::GetWorldRotation() |
| 77 | { |
no outgoing calls