浏览代码

Spawn agents first

/develop/zombieteammanager/disableagent
Ervin Teng 4 年前
当前提交
30a1cb7b
共有 1 个文件被更改,包括 16 次插入15 次删除
  1. 31
      Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs

31
Project/Assets/ML-Agents/Examples/PushBlock/Scripts/ZombiePushBlockDeathEnvController.cs


}
item.Agent.EndEpisode();
}
//Reset Agents
foreach (var item in AgentsList)
{
var pos = UseRandomAgentPosition ? GetRandomSpawnPos() : item.StartingPos;
var rot = UseRandomAgentRotation ? GetRandomRot() : item.StartingRot;
item.Agent.transform.SetPositionAndRotation(pos, rot);
item.Rb.velocity = Vector3.zero;
item.Rb.angularVelocity = Vector3.zero;
item.Col.enabled = true;
item.Agent.frozen = false;
item.Agent.gameObject.SetActive(true);
item.Rb.constraints &= ~RigidbodyConstraints.FreezePositionY;
}
//Reset Blocks
foreach (var item in BlocksList)
{

// Freeze block's motion until zombies are killed
item.Rb.constraints |= RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ;
item.Rb.constraints |= RigidbodyConstraints.FreezeRotationY;
}
//Reset Agents
foreach (var item in AgentsList)
{
var pos = UseRandomAgentPosition ? GetRandomSpawnPos() : item.StartingPos;
var rot = UseRandomAgentRotation ? GetRandomRot() : item.StartingRot;
item.Agent.transform.SetPositionAndRotation(pos, rot);
item.Rb.velocity = Vector3.zero;
item.Rb.angularVelocity = Vector3.zero;
item.Col.enabled = true;
item.Agent.frozen = false;
item.Agent.gameObject.SetActive(true);
item.Rb.constraints &= ~RigidbodyConstraints.FreezePositionY;
}
//End Episode

正在加载...
取消
保存