浏览代码

block agent rotation

/exp-alternate-atten
vincentpierre 4 年前
当前提交
daa75eb5
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 9
      Project/Assets/ML-Agents/Examples/Bullet/Scripts/DodgeAgent.cs

9
Project/Assets/ML-Agents/Examples/Bullet/Scripts/DodgeAgent.cs


{
var forwardForce = Mathf.Clamp(actionBuffers.ContinuousActions[0], -1f, 1f);
var lateralForce = Mathf.Clamp(actionBuffers.ContinuousActions[1], -1f, 1f);
var rotationForce = Mathf.Clamp(actionBuffers.ContinuousActions[2], -1f, 1f);
// var rotationForce = Mathf.Clamp(actionBuffers.ContinuousActions[2], -1f, 1f);
Vector3 dirToGo = transform.forward * forwardForce + transform.right * lateralForce;
Vector3 rotateDir = transform.up * rotationForce;
// Vector3 dirToGo = transform.forward * forwardForce + transform.right * lateralForce;
// Vector3 rotateDir = transform.up * rotationForce;
transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f);
// transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f);
Vector3 dirToGo = new Vector3(1,0,0) * forwardForce + new Vector3(0,0,1)*lateralForce;
m_AgentRb.AddForce(dirToGo * m_BulletSettings.agentRunSpeed,
ForceMode.VelocityChange);

正在加载...
取消
保存