Hey folks, I’m working on a TPC that will allow for fun things like vaulting over subwalls, climbing, etc… anyhow, my first task is to handle vaulting which I believe is close now, see webplayer: http://logicwell.com/nightfall/Nightfall_TPC.html .
I have two issues here:
- MatchTarget - I’m just not having a lot of success with this one, I’m getting a good point to target match too but it makes my rigidbody fall over sometimes and the hand does not snap to that point. Are there any mecanim experts out there yet
? The following code is executed at the start of the vault.
Vector3 targetHandPoint = new Vector3( Player.position.x, Target.collider.bounds.max.y, Target.position.z );
CapsuleCollider cc = Player.GetComponent<CapsuleCollider>( );
if( cc != null )
{
targetHandPoint -= cc.radius * Player.transform.right.normalized;
}
else
{
targetHandPoint -= Player.collider.bounds.size.x * Player.transform.right.normalized;
}
animator.MatchTarget( targetHandPoint, Player.rotation, AvatarTarget.LeftHand,
new MatchTargetWeightMask( Vector3.one, 1.0f ), 0.20f, 0.506f );
- Z-Axis adjustment : So here I’m finding the distance from the wall and if it is too close, adjust the player backwards and make it so
that my animation will be “close” to correct. The better approach i’m thinking is to have two animations where one is for close/slow vault vs a running vault. But my question is if that is what folks are doing typically? Or is there some IK magic / procedural techniques that i’m missing? Seems like IK/proc would make for some complex code.
I’d really like to smooth this out, for point (2) I’ve thought perhaps getting the hands position and adjusting the root to lerp towards the contact point during the animation might help, but ideally i’d like to just have the MatchTarget help with this.