Unity Runtime - Mecanim
Unity Runtime - Mecanim
So I'm trying to get a test character up and running with Creature and Mecanim, but I've run into some issues. I'm having issues with blending animations. I've only been able to find the blend_rate field to modify blending. Are there any options to set blend time? Also, I've tried to set blend time in the transitions, but it doesn't seem to change anything. I have set the do_blending flag on the Creature State Machine Component, but from my understanding of Mecanim, blending options should be defined on the transition and not on the state.
Re: Unity Runtime - Mecanim
Hello,
Creature runtimes are triggered by MecAnim, they do not have full access to internal MecAnim functionality ( because they are not native Unity components )
Blend_rate is basically how quickly it blends to but there is no blend_time option yet ( Blend_rate is basically blend_time, but yes in a more indirect way )
Having said that, if you are not using mesh deform motors or sprite swapping but just bone motors via mesh skinning, you can also export your creature character as a pure FBX file ( export under Images/Video option ). As a FBX model, you have full access to the MecAnim framework in Unity just like any other standard FBX model ( which is why FBX is provided as an export option )
Thanks
Creature runtimes are triggered by MecAnim, they do not have full access to internal MecAnim functionality ( because they are not native Unity components )
Blend_rate is basically how quickly it blends to but there is no blend_time option yet ( Blend_rate is basically blend_time, but yes in a more indirect way )
Having said that, if you are not using mesh deform motors or sprite swapping but just bone motors via mesh skinning, you can also export your creature character as a pure FBX file ( export under Images/Video option ). As a FBX model, you have full access to the MecAnim framework in Unity just like any other standard FBX model ( which is why FBX is provided as an export option )
Thanks
Re: Unity Runtime - Mecanim
Thanks! Is there a conversion from blend_time to blend_rate? Is there more documentation on how it's handled?
Re: Unity Runtime - Mecanim
Hello,
Blend_rate just controls a very simple linear blend factor that gets incremented at every animation step. It basically is assigned to the auto_blend_delta variable.
You can see how it is incremented in CreatureModule.cs:
Blend_rate just controls a very simple linear blend factor that gets incremented at every animation step. It basically is assigned to the auto_blend_delta variable.
You can see how it is incremented in CreatureModule.cs:
Code: Select all
private void ProcessAutoBlending()
{
// process blending factor
blending_factor += auto_blend_delta;
if (blending_factor > 1)
{
blending_factor = 1;
}
}
Re: Unity Runtime - Mecanim
So I added blend time to my local version of the unity runtime. I made ProcessAutoBlending take DeltaTime and multiplied auto_blend_delta by that DeltaTime. You also need to set the blend_rate to the reciprocal of your transition duration. The transition duration can be retrieved from the animator in OnStateEnter.
Re: Unity Runtime - Mecanim
Very nice! That sounds like a good method to convert to Blend times!
Cheers
Cheers