Class URayCastObserver

class URayCastObserver : public UBoxObserver

An observer that casts rays and collects observations about the first object hit.

Public Functions

virtual FBoxSpace GetObservationSpace() const

Get the BoxSpace bounding the outputs of this sensor.

Note

This function should be implemented by any derived classes

Returns:

The ObservationSpace bounding the outputs of this sensor.

TArray<FVector> GenerateRayEndpoints(int32 InNumRays, float InRayDegrees, FVector InBaseEnd, FVector InStart, FTransform InBaseTransform, FVector InEndOffset)

Generate the endpoints of the rays to be cast.

Parameters:
  • InNumRays[in] The number of rays to generate.

  • InRayDegrees[in] The angle between the first and last ray.

  • InBaseEnd[in] The base endpoint of the rays.

  • InStart[in] The start point of the rays.

  • InBaseTransform[in] A transform to apply to the generated endpoints.

Returns:

An array of endpoints for the rays.

void AppendEmptyTags(FBoxPoint &OutObservations)

Add Empty Tags to the ray for ease of adding in one hot encodings.

Parameters:

OutObservations[out] The observations to append the results to.

void HandleRayMiss(FBoxPoint &OutObservations, FVector &InStart, FVector &InEnd)

Helper function for appending the data based on a ray trace that hit nothing.

Parameters:
  • OutObservations[out] The observations to append the results to.

  • InStart[in] The start point of the ray.

  • InEnd[in] The end point of the ray.

void HandleRayHit(FHitResult &InHitResult, FBoxPoint &OutObservations, FVector &InStart)

Handle a SuccesfulRayTrace.

Parameters:
  • InHitResult[in] The result of the ray trace.

  • OutObservations[out] The observations to append the results to.

  • InStart[in] The start point of the ray.

virtual void CollectObservations(FBoxPoint &OutObservations) override

Collect observations about the environment state.

Parameters:

OutObservations[out] A BoxPoint that will be updated with the outputs of this sensor.

Public Members

float RayLength = 4096.f

The baseline length of each ray.

Will be adjusted by the Scale component of RayTransform

TEnumAsByte<ECollisionChannel> CollisionChannel

The collision channel to use for the raycast.

bool bDrawDebugLines = false

Does this sensor draw debug lines/sphere’s during runtime.

bool bTraceComplex = false

Should the sensor trace against complex collision.

int32 NumRays = 2

The number of rays to fire.

float RayDegrees = 90.0f

The angle between the first and last ray.

Special case of 360 degrees.

TArray<FName> TrackedTags

Actor Tags that are checked on raycast collision.

Included in Observations as 1-hot vector.

FTransform RayStartTransform

A transform that is applied to the generated ray trajectories before firing them.

FVector RayEndOffset

A transform that is applied to end points of the generated ray trajectories before firing them.

FColor DebugHitColor = FColor::Green

Debug colour for ray hit.

FColor DebugMissColor = FColor::Red

Debug colour for ray miss.

Related pages

  • Visit the Schola product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!