URayCastObserver
class URayCastObserver : public UBoxObserverAn observer that casts rays and collects observations about the first object hit.
Dependencies: FBoxPoint, FBoxSpace, UBoxObserver
Inherits from: public UBoxObserver
Public Interface
Public Functions:
GetObservationSpace
virtual FBoxSpace GetObservationSpace() const constGet the BoxSpace bounding the outputs of this sensor.
Returns: The ObservationSpace bounding the outputs of this sensor.
Note: This function should be implemented by any derived classes
Returns: FBoxSpace
Attributes: const, virtual
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 66, column 11)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 5-23)
GenerateRayEndpoints
TArray<FVector> GenerateRayEndpoints(int32 InNumRays, float InRayDegrees, FVector InBaseEnd, FVector InStart, FTransform InBaseTransform, FVector InEndOffset)Generate the endpoints of the rays to be cast.
Returns: An array of endpoints for the rays.
Parameters:
InNumRays(int32) – [in] The number of rays to generate.InRayDegrees(float) – [in] The angle between the first and last ray.InBaseEnd(FVector) – [in] The base endpoint of the rays.InStart(FVector) – [in] The start point of the rays.InBaseTransform(FTransform) – [in] A transform to apply to the generated endpoints.InEndOffset(FVector) – [in] An offset to apply to the end points of the rays.
Returns: TArray<FVector>
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 78, column 8)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 25-60)
AppendEmptyTags
void AppendEmptyTags(FBoxPoint &OutObservations)Add empty tags to the ray for ease of adding in one-hot encodings.
Parameters:
OutObservations(FBoxPoint &) – [out] The observations to append the results to.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 84, column 6)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 62-68)
HandleRayMiss
void HandleRayMiss(FBoxPoint &OutObservations, FVector &InStart, FVector &InEnd)Helper function for appending the data based on a ray trace that hit nothing.
Parameters:
OutObservations(FBoxPoint &) – [out] The observations to append the results to.InStart(FVector &) – [in] The start point of the ray.InEnd(FVector &) – [in] The end point of the ray.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 92, column 6)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 70-89)
HandleRayHit
void HandleRayHit(FHitResult &InHitResult, FBoxPoint &OutObservations, FVector &InStart)Handle a successful ray trace.
Parameters:
InHitResult(FHitResult &) – [in] The result of the ray trace.OutObservations(FBoxPoint &) – [out] The observations to append the results to.InStart(FVector &) – [in] The start point of the ray.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 100, column 6)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 91-144)
CollectObservations
virtual void CollectObservations(FBoxPoint &OutObservations) overrideCollect observations about the environment state.
Parameters:
OutObservations(FBoxPoint &) – [out] A BoxPoint that will be updated with the outputs of this sensor.
Attributes: virtual
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 106, column 14)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 146-186)
GenerateId
virtual FString GenerateId() const override constReturns: FString
Attributes: const, virtual
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 108, column 9)
Implementation: Schola/Source/Schola/Private/Observers/RayCastObserver.cpp (lines 188-208)
Public Members:
float RayLength
float RayLength = = 4096.fThe baseline length of each ray.
Will be adjusted by the scale component of RayTransform.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 24, column 7)
TEnumAsByte<ECollisionChannel> CollisionChannel
TEnumAsByte<ECollisionChannel> CollisionChannelThe collision channel to use for the raycast.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 28, column 13)
bool bDrawDebugLines
bool bDrawDebugLines = = falseDoes this sensor draw debug lines/spheres during runtime.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 32, column 6)
bool bTraceComplex
bool bTraceComplex = = falseShould the sensor trace against complex collision.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 36, column 6)
int32 NumRays
int32 NumRays = = 2The number of rays to fire.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 40, column 7)
float RayDegrees
float RayDegrees = = 90.0fThe angle between the first and last ray.
Special case of 360 degrees.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 44, column 7)
TArray<FName> TrackedTags
TArray<FName> TrackedTagsActor tags that are checked on raycast collision.
Included in observations as a 1-hot vector.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 48, column 8)
FTransform RayStartTransform
FTransform RayStartTransformA transform that is applied to the generated ray trajectories.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 52, column 12)
FVector RayEndOffset
FVector RayEndOffsetA position adjustment that is applied to end points of the generated ray trajectories.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 56, column 9)
FColor DebugHitColor
FColor DebugHitColor = = FColor::GreenDebug color for ray hit.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 60, column 8)
FColor DebugMissColor
FColor DebugMissColor = = FColor::RedDebug color for ray miss.
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 64, column 8)
Private Interface
Private Members:
constexpr const float kLineGirth
static constexpr const float kLineGirth = = 1.fAttributes: static, private
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 18, column 30)
constexpr const float kSphereRadius
static constexpr const float kSphereRadius = = 16.fAttributes: static, private
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 19, column 30)
Source: Schola/Source/Schola/Public/Observers/RayCastObserver.h (line 14, column 1)