Exploring Pose::GetGlobalTransform
One of the things that makes the GetGlobalTransform
function of the Pose
class is that it always calculates the world transform. Consider a situation where you request the world transform of a node, then immediately after, the world transform of its parent node. The original request calculates and uses the world transform of the parent node, but as soon as the next request is made, that same transform is calculated again.
The solution to this is to add two new arrays to the Pose
class. One is a vector of world space transforms and the other contains dirty flags. Any time a joint's local transform is set, the dirty flag of the joint needs to be set to true
.
When a world transform is requested, the dirty flag of the transform and all its parents is checked. If there is a dirty transform in that chain, the world transform is re-calculated. If the dirty flag is not set, the cached world transform is returned.
You will not implement this...