public SeObservation GetObservation() { var characterPosition = GetPlayerPosition(); var sphere = new BoundingSphereD(characterPosition, radius: 25.0); var rayCastResults = sensors.CastRaysAroundPlayer(Character, 30, 16); var transformedResults = rayCastResults.Select(x => { if (x.IsHit) { return(x.HitDistance.Value / x.MaxDistance); } return(1); }).ToList(); return(new SeObservation { AgentID = "se0", Position = new PlainVec3D(characterPosition), // Consider reducing allocations. Velocity = new PlainVec3D(GetPlayerVelocity()), Extent = AgentExtent, // Entities = CollectSurroundingEntities(sphere), // TODO(PP): Don't return both entities and blocks (duplicate work). // Blocks = CollectSurroundingBlocks(sphere), RayCastResults = transformedResults, }); }