GitHub
4 年前
当前提交
fac11fa7
共有 7 个文件被更改,包括 107 次插入 和 41 次删除
-
29com.unity.ml-agents/Runtime/Sensors/BoxOverlapChecker.cs
-
6com.unity.ml-agents/Runtime/Sensors/GridSensorBase.cs
-
22com.unity.ml-agents/Runtime/Sensors/GridSensorComponent.cs
-
12com.unity.ml-agents/Tests/Runtime/Sensor/BoxOverlapCheckerTests.cs
-
6com.unity.ml-agents/Tests/Runtime/Sensor/GridSensorTests.cs
-
62com.unity.ml-agents/Runtime/Sensors/IGridPerception.cs
-
11com.unity.ml-agents/Runtime/Sensors/IGridPerception.cs.meta
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace Unity.MLAgents.Sensors |
|||
{ |
|||
/// <summary>
|
|||
/// An interface for GridSensor perception that defines the grid cells and collider detecting strategies.
|
|||
/// </summary>
|
|||
internal interface IGridPerception |
|||
{ |
|||
bool RotateWithAgent |
|||
{ |
|||
get; |
|||
set; |
|||
} |
|||
|
|||
LayerMask ColliderMask |
|||
{ |
|||
get; |
|||
set; |
|||
} |
|||
|
|||
/// <summary>Converts the index of the cell to the 3D point (y is zero) relative to grid center</summary>
|
|||
/// <returns>Vector3 of the position of the center of the cell relative to grid center</returns>
|
|||
/// <param name="cellIndex">The index of the cell</param>
|
|||
Vector3 GetCellLocalPosition(int cellIndex); |
|||
|
|||
/// <summary>
|
|||
/// Converts the index of the cell to the 3D point (y is zero) in world space
|
|||
/// based on the result from GetCellLocalPosition()
|
|||
/// </summary>
|
|||
/// <returns>Vector3 of the position of the center of the cell in world space</returns>
|
|||
/// <param name="cellIndex">The index of the cell</param>
|
|||
Vector3 GetCellGlobalPosition(int cellIndex); |
|||
|
|||
Quaternion GetGridRotation(); |
|||
|
|||
/// <summary>
|
|||
/// Perceive the latest grid status. Detect colliders for each cell, parse the collider arrays,
|
|||
/// then trigger registered sensors to encode and update with the new grid status.
|
|||
/// </summary>
|
|||
void Perceive(); |
|||
|
|||
/// <summary>
|
|||
/// Same as Perceive(), but only load data for debug gizmo.
|
|||
/// </summary>
|
|||
void UpdateGizmo(); |
|||
|
|||
/// <summary>
|
|||
/// Register a sensor to this GridPerception to receive the grid perception results.
|
|||
/// When the GridPerception perceive a new observation, registered sensors will be triggered
|
|||
/// to encode the new observation and update its data.
|
|||
/// </summary>
|
|||
void RegisterSensor(GridSensorBase sensor); |
|||
|
|||
/// <summary>
|
|||
/// Register an internal debug sensor.
|
|||
/// Debug sensors will only be triggered when drawing debug gizmos.
|
|||
/// </summary>
|
|||
void RegisterDebugSensor(GridSensorBase debugSensor); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 87820d9eb927c4fa483dff9289d983f1 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue