Unity 机器学习代理工具包 (ML-Agents) 是一个开源项目,它使游戏和模拟能够作为训练智能代理的环境。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

28 行
1.1 KiB

using UnityEngine;
namespace MLAgentsExamples
{
/// <summary>
/// This class contains logic for common ragdoll operations & helper methods.
/// </summary>
public static class RagdollHelpers
{
/// <summary>
//Get Joint Rotation Relative to the Connected Rigidbody
//We want to collect this info because it is the actual rotation, not the "target rotation"
//..because when the joint is weak, the target rotation will be much different than the actual rotation
/// </summary>
public static Quaternion GetJointRotation(ConfigurableJoint joint)
{
Quaternion rotDiff = Quaternion.Inverse(joint.connectedBody.transform.rotation) * joint.transform.rotation;
return(rotDiff);
// return(Quaternion.FromToRotation(joint.axis, joint.connectedBody.transform.rotation.eulerAngles));
}
public static Quaternion GetRotationDelta(Quaternion r1, Quaternion r2)
{
Quaternion rotDiff = Quaternion.Inverse(r1) * r2;
return(rotDiff);
}
}
}