Skip to content

AcresCoreScene.h#

Game/Core/Source/AcresCoreScene.h Generated

The static obstacles of the ACRE map for ACRES Core: buildings, grain bins and trees as simplified shapes (Game/Core/Data/acre_scene.json, written by Game/Core/Scripts/build_scene.py from placed render meshes and the level's tree instances), for the ray-cast LiDAR (AcresCoreLidar.h) and the vehicles' collision test.

Geometry: triangles (walls, roofs, bin cones), vertical capped cylinders (bin walls, tree trunks) and axis-aligned ellipsoids (tree crowns, with a source leaf-height floor for named meshes), in one bounding volume hierarchy (binned SAH, 16 bins, up to 4 primitives per leaf). Crowns report only rays that enter them from outside, so a crown is one foliage layer (the LiDAR decides whether the beam passes it, AcresCoreLidar.h). Collision footprints are the buildings' measured outlines and the bins' circles (polygons with a z range) plus the trunk circles, on a uniform 8 m grid.

Frames: Core ENU metres (x east, y north, z up). Read-only after Load: any number of threads may query it.

FAcresSceneMaterial#

struct FAcresSceneMaterial

LiDAR optics of a material (sensors_polaris.json lidar.materials; AcresLidarModel.h in the game).

Name Type Unit Default Description
Reflectivity, Transmission, Specular, SpecularWidthDeg, IncidenceExponent, WetDarkening double Diffuse reflectance at 905 nm, 0-1; share of a beam a foliage layer lets through, 0-1; specular lobe peak and width, deg; Minnaert exponent; darkening when wet, 0-1.
ReflectivityQuantiles std::vector<double> Optional equally spaced empirical quantiles of diffuse reflectance (0-1), sampled in fixed 0.1 m cells.

FAcresScene#

class FAcresScene

The static obstacle scene.

Example

FAcresScene Scene;
Scene.Load("Game/Core/Data/acre_scene.json");
FRayHit Hit;
int Material = -1;
if (Scene.RayCast(Origin, Direction, 100, Hit, Material)) ...
Name Type Unit Default Description
BoundsMin, BoundsMax FVec3 Bounds of all primitives, m.

FAcresScene::Load#

Reads a scene file (schema acres-core-scene-1) and builds the hierarchy and the collision grid.

Argument Description
Path The JSON file.
Error Why it failed (may be null).

Returns: True on success.

bool Load(const std::string& Path, std::string* Error = nullptr);

FAcresScene::LoadObstacles#

Replaces the collision obstacles with the scouting map's (Game/Content/Simulation/ACRE/Scouting/obstacles.json, schema acres-obstacles-1: the level's collision outlines of buildings, the structure, props and the parked car, the bin cylinders and the 6,984 tree trunks; the geometry of the obstacle class of ground_classes.u8), so the Core's collisions and obstacle distances are the task's. Requires the same obstacle-file fingerprint used to build the LiDAR geometry. A different revision is rejected: rebuild the scene instead of leaving removed or moved objects visible to LiDAR. Reloading does not add render primitives.

Argument Description
Path obstacles.json.
Terrain Retained for API compatibility.
Error Why it failed (may be null).

Returns: True on success (the scene is unchanged on failure).

bool LoadObstacles(const std::string& Path, const FAcresTerrain& Terrain, std::string* Error = nullptr);

FAcresScene::ValidateSourceIdentity#

Checks the generated source identity. Real local Unreal source files must match their export fingerprints. Missing source files and Git LFS pointers are permitted for portable Core installations. The small generated identity manifest must still match this scene revision.

bool ValidateSourceIdentity(const std::string& IdentityPath, const std::string& SourceRoot, std::string* Error = nullptr) const;

FAcresScene::ObstacleName#

Id of a collision obstacle (Overlaps' ObstacleId): the obstacles.json id, "trunk" or the scene's footprint kind.

std::string ObstacleName(int ObstacleId) const;

FAcresScene::RayCast#

Closest hit along a ray.

Argument Description
Origin Ray start, m.
Direction Direction (any length; T is in its units).
MaxT Farthest T.
Hit Receives the hit (normal faces the ray).
Material Receives the material index (MaterialCount() lists them).
MinT Nearest T accepted (to continue a ray past a foliage layer).

Returns: True on a hit with MinT < T <= MaxT.

bool RayCast(const FVec3& Origin, const FVec3& Direction, double MaxT, FRayHit& Hit, int& Material, double MinT = 0) const;

FAcresScene::Occluded#

True when anything blocks the ray within MaxT (foliage included).

bool Occluded(const FVec3& Origin, const FVec3& Direction, double MaxT) const;

FAcresScene::RayCastBruteForce#

RayCast over every primitive without the hierarchy (tests).

bool RayCastBruteForce(const FVec3& Origin, const FVec3& Direction, double MaxT, FRayHit& Hit, int& Material, double MinT = 0) const;

FAcresScene::Overlaps#

Whether an oriented box on the ground touches an obstacle.

The box is a rectangle in plan (centre, yaw about z counter-clockwise from east, half length along its heading and half width across it) swept between ZMin and ZMax; it is tested against the building and bin footprints and the trunk circles whose z ranges overlap.

Argument Description
Centre Box centre, m (z unused).
Yaw Heading, rad. HalfLengthM, HalfWidthM: Half extents in plan, m. ZMin, ZMax: Height range, m.
ObstacleId Receives the first obstacle touched (index into the footprints, then the trunks; may be null).

Returns: True on contact.

bool Overlaps(const FVec3& Centre, double Yaw, double HalfLengthM, double HalfWidthM, double ZMin, double ZMax, int* ObstacleId = nullptr) const;

FAcresScene::NearestObstacleM#

Distance in plan from a point to the nearest obstacle footprint or trunk within MaxM (MaxM when none).

double NearestObstacleM(double X, double Y, double MaxM) const;

FAcresScene::TriangleCount#

Counts: triangles, cylinders, ellipsoids, all primitives, collision obstacles (footprints + trunks), BVH nodes.

int TriangleCount() const ;

FAcresScene::MaterialCount#

Materials, indexed by the Material of a hit.

int MaterialCount() const ;

FAcresScene::FindMaterial#

Index of a material by name, or -1.

int FindMaterial(const std::string& Name) const;

EPrimitive#

enum EPrimitive : uint8_t

Primitive kinds.

Value Description
Triangle
Cylinder
Ellipsoid