浏览代码

Add useVectorFrozenFlag option in FoodCollector (#4552)

/release_8_branch
GitHub 4 年前
当前提交
c02ecf14
共有 2 个文件被更改,包括 17 次插入5 次删除
  1. 12
      Project/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
  2. 10
      Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs

12
Project/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab


myLaser: {fileID: 1900094563283840}
contribute: 0
useVectorObs: 0
useFrozenFlag: 1
useVectorFrozenFlag: 1
--- !u!114 &114326390494230518
MonoBehaviour:
m_ObjectHideFlags: 0

m_Width: 84
m_Height: 84
m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &4034342608499629224
MonoBehaviour:

myLaser: {fileID: 1307818939507544}
contribute: 0
useVectorObs: 0
useFrozenFlag: 1
useVectorFrozenFlag: 1
--- !u!114 &114429222608880102
MonoBehaviour:
m_ObjectHideFlags: 0

m_Width: 84
m_Height: 84
m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &7234640249101665162
MonoBehaviour:

myLaser: {fileID: 1898252046043334}
contribute: 0
useVectorObs: 0
useFrozenFlag: 1
useVectorFrozenFlag: 1
--- !u!114 &114036270357198286
MonoBehaviour:
m_ObjectHideFlags: 0

m_Width: 84
m_Height: 84
m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &3164735207755090463
MonoBehaviour:

myLaser: {fileID: 1779831409734062}
contribute: 0
useVectorObs: 0
useFrozenFlag: 1
useVectorFrozenFlag: 1
--- !u!114 &114322691115031348
MonoBehaviour:
m_ObjectHideFlags: 0

m_Width: 84
m_Height: 84
m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &5903164052970896384
MonoBehaviour:

10
Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs


public GameObject myLaser;
public bool contribute;
public bool useVectorObs;
[Tooltip("Use only the frozen flag in vector observations. If \"Use Vector Obs\" " +
"is checked, this option has no effect. This option is necessary for the " +
"VisualFoodCollector scene.")]
public bool useVectorFrozenFlag;
EnvironmentParameters m_ResetParams;

var localVelocity = transform.InverseTransformDirection(m_AgentRb.velocity);
sensor.AddObservation(localVelocity.x);
sensor.AddObservation(localVelocity.z);
sensor.AddObservation(m_Frozen);
sensor.AddObservation(m_Frozen);
else if (useVectorFrozenFlag)
{
sensor.AddObservation(m_Frozen);
}
}
public Color32 ToColor(int hexVal)

正在加载...
取消
保存