We have spine skeletons attached in some hierarchy of nodes. So we may move the skeleton without doing anything on the skeleton, which has worked fine until now.
Now we want to update the skeletons physics based on global movement. Fx if we move a parent node of the skeleton, we want the physics of the skeleton to react to that movement. How do we best achieve that?
Currently, we have this solution:
skeleton.updateWorldTransform(Physics.none);
skeleton.updateWorldTransformWith(Physics.update, worldBone);
Where worldBone
is set up with the global transform of the skeleton.
This solution works, the only caveat is that worldBone
is created like a plain javascript object:
worldBone = {
a: aValue,
b: bValue,
c: cValue,
d: dValue,
worldX: worldXValue,
worldY: worldYValue
};
The Bone constructor requires some data and a skeleton which is not necessary for this use case, so we use a simple object and then have to add a typecast to make the compiler happy. Is there a better method for achieving this behavior?