Version: 2020.2
public void SolveIK ();

描述

执行反向动力学解算器。

使用当前在 AnimationHumanStream 中设置的反向动力学目标位置、旋转和权重来执行人形反向动力学解算器。

using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;

public struct IKJob : IAnimationJob { public TransformSceneHandle effector; public PropertySceneHandle positionWeight; public PropertySceneHandle rotationWeight;

public void ProcessRootMotion(AnimationStream stream) {}

public void ProcessAnimation(AnimationStream stream) { AnimationHumanStream humanStream = stream.AsHuman(); if (effector.IsValid(stream) && positionWeight.IsValid(stream) && rotationWeight.IsValid(stream)) { humanStream.SetGoalPosition(AvatarIKGoal.LeftFoot, effector.GetPosition(stream)); humanStream.SetGoalRotation(AvatarIKGoal.LeftFoot, effector.GetRotation(stream)); humanStream.SetGoalWeightPosition(AvatarIKGoal.LeftFoot, positionWeight.GetFloat(stream)); humanStream.SetGoalWeightRotation(AvatarIKGoal.LeftFoot, rotationWeight.GetFloat(stream)); }

humanStream.SolveIK(); } }