You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a proper way of programatically controlling animations at runtime for bones and constraints, that would also allow for blending with other, regular animations?
So far I managed to do it for bones by modifying animation state timeline, but it's more of a hack, so I'm wondering if I'm doing this the hard way, or there really isn't any support for that.
The text was updated successfully, but these errors were encountered:
Thanks! Unfortunately it doesn't mix with animation states, because it's just an additive transform, but I figured out a correction for this. Here is a quick draft in case someone will need it. I'm not sure if this covers blending by groups.
void dbSetPose(dragonBones::Bone *bone, dragonBones::Transform trf, std::string animation) {
float weight = 1.0f;
auto states = bone->getArmature()->getAnimation()->getStates();
int baseLayer = bone->getArmature()->getAnimation()->getState(animation)->layer;
bool beforeBaseAnimation = true; // Priority is layer first, and then order in state list
for (auto state : states) {
if (state->layer < baseLayer) {
continue;
}
if (state->layer == baseLayer && beforeBaseAnimation) {
continue;
}
if (state->getName().compare(animation) == 0) {
weight = min(weight, state->_weightResult);
beforeBaseAnimation = false;
}
else if (state->containsBoneMask(bone->getName())) {
weight = min(weight, 1.0 - state->_weightResult); // Apply overlaid weights
}
}
trf.x *= weight;
trf.y *= weight;
trf.rotation *= weight;
bone->offset = trf;
bone->invalidUpdate();
}
Is there a proper way of programatically controlling animations at runtime for bones and constraints, that would also allow for blending with other, regular animations?
So far I managed to do it for bones by modifying animation state timeline, but it's more of a hack, so I'm wondering if I'm doing this the hard way, or there really isn't any support for that.
The text was updated successfully, but these errors were encountered: