hkaAnimationControl

hkaAnimationControl

    Hi,

              what is the difference of weight and masterWeight in animation control ?

             I also found there is no setWeight function in animation control ?

 THX!   

publicaciones de 9 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi Golden Li--

The master weight is a control (input) exposed to the user, while the Weight is the final (output) weight after applying ease-in/ease-out curves to the master weight.. The weight (m_weight) is updated every frame by hkaDefaultAnimationControl::update(), and it can only be specified. It's for this reason there is no setWeight() function.

Please let me know if you have any further questions - thanks!

--Tim

<duplicate post>

Hi Tim,
I just want to achive a mixer blending animation.

void MixerAnimControl::update(hkReal stepDelta)
{
hkReal controlWeight = getWeight() / getMasterWeight();
hkReal weightA = m_blendVariable;
hkReal weightB = 1 - weightA;

// Sync playback speeds
if(m_speedSync)
{
const hkReal totalW = weightA+weightB+1e-6f;
const hkReal BP = weightB / totalW;
const hkReal AP = weightA / totalW;
const hkReal abRatio = m_blendCtrlA->getDuration() / m_blendCtrlB->getDuration();
m_blendCtrlA->setPlaybackSpeed( (1-AP) * abRatio + AP );
m_blendCtrlB->setPlaybackSpeed( (1-BP) * (1.0f / abRatio) + BP );
}

m_blendCtrlA->setMasterWeight( weightA * controlWeight );
m_blendCtrlB->setMasterWeight( weightB * controlWeight );

__super::update(stepDelta);
}

MixerAnimControl is the master control that holds the two blend controls, they are all derive from hkaDefaultAnimationControl.
I`m not sure if it is a right method to do it.

Hi Golden Li--

If you havean't done so already, you should look at the Animation Blending demo provided with the PCXS SDK (Demo\Demos\Animation\Api\Blending\Normal) for an example of how to mix two animations. Once you've got a good handle on how this works, you'll be in a better situation to encapsulate this functionality in a wrapper class.

I'm not entirely sure what you're trying to do, but if I interprete it correctly, you should be able to just replace the first line of your function body with:

 hkReal controlWeight = getWeight() 

If this doesn't work, please describe what artifacts you see. Thanks!

--Tim

Hi Tim, I want to do something like a animation blend tree, every MixerAnimControl is a tree node in the blend tree.

 MixControl(A) ---  MixControl(B) ---  MixControl(D)

                                                        ---  MixControl(E)

                       ---   MixControl(C)

The animation weight of D and E should not larger the the weight of C.

So I`m a bit of confused with weight and masterweight, dose the master weight effect the caculation of the final weight in animation control ?

Hi Golden Li--

The master weight can be changed, while the weight is calculated from the master weight and used internally. If you have no ease-in/ease-out curves, the weight is exactly equal to the value you set with the master weight. This means that these values are only different during an interval of time immediately after you change the master weight. Does that make sense?

--Tim

Hi Tim,
That`s what I need, Thanks a lot !.

BR,
Lixin

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya