我几乎成功地实现了Active ragdoll,但我的旋转应用于物理模型时却是错误的。我尝试了反转目标旋转、调整轴和次要轴,但目前似乎没有什么方法能给出正确的动画,除了T Pose之外,它被复制得完美无瑕。
以下是我的CopyMotion脚本:
public class CopyMotion : MonoBehaviour
{
public Transform target;
ConfigurableJoint joint;
public bool mirror;
Quaternion startRot;
// Start方法在MonoBehaviour创建后第一次执行Update之前被调用
void Start()
{
joint = GetComponent<ConfigurableJoint>();
startRot = transform.localRotation;
}
// Update方法每帧被调用
void Update()
{
if (!mirror)
{
joint.SetTargetRotationLocal(target.rotation, startRot);
}
else
{
joint.SetTargetRotationLocal(Quaternion.Inverse(target.rotation), startRot);
}
}
}
评论 (0)