Lysa  0.0
Lysa 3D Engine
RayCast Class Referenceabstract

Detailed Description

A ray in 3D space, used to find the first CollisionObject it intersects.

+ Inheritance diagram for RayCast:

Public Member Functions

 RayCast (const float3 &target, collision_layer layer)
 
 RayCast () = default
 
 ~RayCast () override
 
auto isColliding () const
 
auto getCollider () const
 
auto getCollisionPoint () const
 
void setExcludeParent (const bool exclude)
 
void update ()
 
void setTarget (const float3 &target)
 
const auto & getTarget () const
 
void setCollisionLayer (collision_layer layer)
 
virtual float3 getGlobalPosition () const = 0
 
virtual float3 localPositionToGlobalPosition (const float3 &position) const = 0
 
virtual bool isProcessed () const = 0
 
virtual bool isParent (const CollisionObject *collisionObject) const = 0
 
- Public Member Functions inherited from UnmanagedResource
 UnmanagedResource ()
 
 UnmanagedResource (const Resource &other)
 
- Public Member Functions inherited from Resource
bool operator== (const Resource &other) const
 
 Resource () = default
 
 Resource (const unique_id id)
 
virtual ~Resource () = default
 

Protected Attributes

bool active {false}
 
float3 target {}
 
float3 hitPoint {}
 
collision_layer collisionLayer {}
 
bool excludeParent {true}
 
CollisionObjectcollider {nullptr}
 
unique_id onPhysicsProcessHandler {INVALID_ID}
 

Additional Inherited Members

- Public Attributes inherited from Resource
unique_id id {INVALID_ID}
 

Constructor & Destructor Documentation

RayCast ( const float3 &  target,
collision_layer  layer 
)

Creates a RayCast

Parameters
targetThe ray's destination point, relative to the RayCast's position
layerThe ray's collision layer
RayCast ( )
default

Creates an inactive RayCast

~RayCast ( )
override

Member Function Documentation

auto getCollider ( ) const
inline

Returns the first object that the ray intersects, or nullptr if no object is intersecting the ray

auto getCollisionPoint ( ) const
inline

Returns the collision point at which the ray intersects the closest object, in the global coordinate system

virtual float3 getGlobalPosition ( ) const
pure virtual
const auto& getTarget ( ) const
inline

Returns the ray target

auto isColliding ( ) const
inline

Returns whether any object is intersecting with the ray's vector (considering the vector length).

virtual bool isParent ( const CollisionObject collisionObject) const
pure virtual
virtual bool isProcessed ( ) const
pure virtual
virtual float3 localPositionToGlobalPosition ( const float3 &  position) const
pure virtual
void setCollisionLayer ( collision_layer  layer)
void setExcludeParent ( const bool  exclude)
inline

If true, collisions will be ignored for this RayCast's immediate parent.

void setTarget ( const float3 &  target)
inline

Sets the ray's destination point, relative to the RayCast's position.

void update ( )

Updates the collision information for the ray immediately, without waiting for the next physics update

Member Data Documentation

bool active {false}
protected
CollisionObject* collider {nullptr}
protected
collision_layer collisionLayer {}
protected
bool excludeParent {true}
protected
float3 hitPoint {}
protected
unique_id onPhysicsProcessHandler {INVALID_ID}
protected
float3 target {}
protected