浏览代码

moved look rotation logic to avoid potential NaN LookRotation

/develop-gpu-test
Hunter 6 年前
当前提交
83703d20
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 10
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs

10
UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs


{
jdController = GetComponent<JointDriveController>();
currentDecisionStep = 1;
dirToTarget = target.position - body.position;
//Setup each body part
jdController.SetupBodyPart(body);

public override void CollectObservations()
{
jdController.GetCurrentJointForces();
// Normalize dir vector to help generalize
// Update pos to target
dirToTarget = target.position - body.position;
// Forward & up to help with orientation
RaycastHit hit;
if (Physics.Raycast(body.position, Vector3.down, out hit, 10.0f))
{

AddVectorObs(10.0f);
// Forward & up to help with orientation
Vector3 bodyForwardRelativeToLookRotationToTarget = targetDirMatrix.inverse.MultiplyVector(body.forward);
AddVectorObs(bodyForwardRelativeToLookRotationToTarget);

}
}
}
// Update pos to target
dirToTarget = target.position - jdController.bodyPartsDict[body].rb.position;
// If enabled the feet will light up green when the foot is grounded.
// This is just a visualization and isn't necessary for function

正在加载...
取消
保存