Represents an anchor in the Mixed Reality Utility Kit. This combines an Unreal actor with the scene anchor. The actor is placed at the position of the anchor and the actor's rotation is set to match the rotation of the anchor. Provides functions to check if a position is inside the volume or plane of the anchor, raycast against the anchor, etc...
The semantic classification of the anchor, also sometimes refered to as labels for short. This can be for example FLOOR, COUCH, TABLE, SCREEN, BED, LAMP, etc...
FBox2D PlaneBounds[Get]
If the anchor has a plane attached to it, this represents the bounds of that plane in local coordinate space.
TArray< FVector2D > PlaneBoundary2D[Get]
If the anchor has a plane attached to it, this represents the boundary of it in local coordinate space. For rectangular boundaries this will be the same as the PlaneBounds.
FBox VolumeBounds[Get]
If the anchor has a volume attached to it, this represents the bounds of that volume in local coordinate space.
Array of all children attached to it, e.g. if this is a wall, it could have an array of door/window frames. If this is a desk it could have an array of screens on it.
Positions of the global mesh. Only populated if the anchor is has the label GLOABL_MESH and the option UseSharedLibraryForAnchorLoading is set to true.
TArray< int > SceneMeshIndices[Get]
Indices of the global mesh. Only populated if the anchor is has the label GLOABL_MESH and the option UseSharedLibraryForAnchorLoading is set to true.
Member Functions
bool IsPositionInBoundary
( const FVector2D & Position )
Check if a 2D position is within the boundary of the plane. The position should be in the local coordinate system NOT world coordinates.
FVector GenerateRandomPositionOnPlane ( )
Generate a uniform random position within the boundary of the plane.
Returns
The random position in local coordinate space.
FVector GenerateRandomPositionOnPlaneFromStream
( const FRandomStream & RandomStream )
Generate a uniform random position within the boundary of the plane from a random stream.
Parameters
RandomStream
A random generator used to generate the position on the plane.
Attach a procedural mesh to the anchor. The mesh will match the size, position and shape of the volume and/or plane if they are set.
Parameters
PlaneUVAdjustments
Scale and offset to apply to the UV texture coordinates. If more than one is specified then multiple UV texture coordinates are created (up to 4) and adjustments applied to each. This can be left empty in which case a single set of UV texture coordinates are created in the range 0 to 1 for the plane.
CutHoleLabels
Labels for which the generated mesh should have holes. Only works with planes.
Generate a procedural mesh for the anchor. The mesh will match the size, position and shape of the volume and/or plane if they are set.
Parameters
ProceduralMesh
The procedural mesh component that should be used to store the generated mesh.
PlaneUVAdjustments
Scale and offset to apply to the UV texture coordinates. If more than one is specified then multiple UV texture coordinates are created (up to 4) and adjustments applied to each. This can be left empty in which case a single set of UV texture coordinates are created in the range 0 to 1 for the plane.
CutHoleLabels
Labels for which the generated mesh should have holes. Only works with planes.
GenerateCollision
Whether to generate collision geometry or not
Offset
A offset to make the procedural mesh slightly bigger or smaller than the anchors volume/plane.
Calculate the closest surface position on this anchor.
Parameters
TestPosition
The position in world space for which the closes surface position should be obtained.
OutSurfacePosition
The closest surface position
Returns
The distance between TestPosition and OutSurfacePosition
bool IsPositionInVolumeBounds
( const FVector & Position,
bool TestVerticalBounds,
double Tolerance )
Checks if the given position is on or inside the volume bounds. Floor, ceiling and wall anchors will be excluded from the search.
Parameters
Position
The position in world space to check
TestVerticalBounds
Whether the vertical bounds should be checked or not
Tolerance
Tolerance
Returns
The anchor the WorldPosition is in. A null pointer otherwise.
FVector GetFacingDirection ( )
Gets a natural “forward” direction for anchors; for planes, this is always Z-forward. For volumes, it’s the X/Y cardinal axis that aligns best with the normal of the closest wall.