| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | public class IdealSensor : Sensor { |
| 0 | 4 | | public override SensorOutput Sense(Agent agent) { |
| 0 | 5 | | SensorOutput agentSensorOutput = new SensorOutput(); |
| | 6 | |
|
| | 7 | | // Adapt the relative transformation to the agent for the sensor output. |
| 0 | 8 | | Transformation relativeTransformation = _agent.GetRelativeTransformation(agent); |
| 0 | 9 | | agentSensorOutput.position = relativeTransformation.position; |
| 0 | 10 | | agentSensorOutput.velocity = relativeTransformation.velocity; |
| | 11 | |
|
| 0 | 12 | | return agentSensorOutput; |
| 0 | 13 | | } |
| | 14 | |
|
| 0 | 15 | | public override SensorOutput SenseWaypoint(Vector3 waypoint) { |
| 0 | 16 | | SensorOutput waypointSensorOutput = new SensorOutput(); |
| | 17 | |
|
| | 18 | | // Adapt the agent's relative transformation to the waypoint for the sensor output. |
| 0 | 19 | | Transformation relativeTransformation = _agent.GetRelativeTransformationToWaypoint(waypoint); |
| 0 | 20 | | waypointSensorOutput.position = relativeTransformation.position; |
| 0 | 21 | | waypointSensorOutput.velocity = relativeTransformation.velocity; |
| | 22 | |
|
| 0 | 23 | | return waypointSensorOutput; |
| 0 | 24 | | } |
| | 25 | | } |