浏览代码

more cleanup

/develop/dodgeball-tests
HH 4 年前
当前提交
67442e36
共有 2 个文件被更改,包括 10 次插入16 次删除
  1. 20
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/AgentCubeMovement.cs
  2. 6
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs

20
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/AgentCubeMovement.cs


public void RunOnGround(Vector3 dir)
{
// print(dir);
//ADD FORCE
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunSpeed - vel, 0, agentTerminalVel);
rb.AddForce(dir * adjustedSpeed, runningForceMode);
//ANIMATE MESH
if (dir == Vector3.zero)
{
if (AnimateBodyMesh)

}
else
{
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunSpeed - vel, 0, agentTerminalVel);
// float adjustedSpeed = Mathf.MoveTowards(vel, agentRunSpeed, WalkSmoothing);
// float adjustedSpeed = Mathf.SmoothDamp(vel, agentRunSpeed, ref agentVel, WalkSmoothing, agentTerminalVel);
// rb.AddForce(dir.normalized * adjustedSpeed, runningForceMode);
rb.AddForce(dir * adjustedSpeed, runningForceMode);
if (AnimateBodyMesh)
{
bodyMesh.localPosition = Vector3.zero +

}
// rb.AddForceAtPosition(dir.normalized * adjustedSpeed,transform.TransformPoint(Vector3.forward * standingForcePositionOffset),
// runningForceMode);
public void RunOnGround(Rigidbody rb, Vector3 dir)
{
print(dir);

6
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs


//HANDLE ROTATION
m_CubeMovement.Look(m_Rotate);
Vector3 moveDir = Vector3.zero;
// moveDir = input.Cam.transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
// moveDir.y = 0;
moveDir = transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
var moveDir = transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
m_CubeMovement.RunOnGround(moveDir);
// if (AgentShield && act[6] > 0)

正在加载...
取消
保存