Leviathan  0.8.0.0
Leviathan game engine
Leviathan::RayCastHitEntity Class Reference

#include <GameWorld.h>

+ Inheritance diagram for Leviathan::RayCastHitEntity:

Public Member Functions

DLLEXPORT RayCastHitEntity (const NewtonBody *ptr=nullptr, const float &tvar=0.f, RayCastData *ownerptr=nullptr)
 
DLLEXPORT RayCastHitEntityoperator= (const RayCastHitEntity &other)
 
DLLEXPORT bool HasHit ()
 
DLLEXPORT Float3 GetPosition ()
 
DLLEXPORT bool DoesBodyMatchThisHit (NewtonBody *other)
 
- Public Member Functions inherited from Leviathan::ReferenceCounted
 ReferenceCounted (const ReferenceCounted &other)=delete
 
ReferenceCountedoperator= (const ReferenceCounted &other)=delete
 
FORCE_INLINE void AddRef ()
 
FORCE_INLINE void Release ()
 removes a reference and deletes the object if reference count reaches zero More...
 
int32_t GetRefCount () const
 Returns the reference count. More...
 

Public Attributes

const NewtonBody * HitEntity
 
float HitVariable
 The distance from the start of the ray to the hit location. More...
 
Float3 HitLocation
 

Additional Inherited Members

- Public Types inherited from Leviathan::ReferenceCounted
using basepointer = boost::intrusive_ptr< ReferenceCounted >
 
using refcountedpointer = boost::intrusive_ptr< ReferenceCounted >
 
- Static Public Member Functions inherited from Leviathan::ReferenceCounted
template<class ActualType >
static boost::intrusive_ptr< ActualType > WrapPtr (ActualType *ptr)
 Creates an intrusive_ptr from raw pointer. More...
 
template<class ActualType , class... Args>
static boost::intrusive_ptr< ActualType > MakeShared (Args &&... args)
 Constructs a new instance and wraps it. More...
 
- Protected Member Functions inherited from Leviathan::ReferenceCounted
DLLEXPORT ReferenceCounted ()
 
virtual DLLEXPORT ~ReferenceCounted ()
 

Detailed Description

Holds the returned entity that was hit during ray casting

Todo:
Move to a new file

Definition at line 54 of file GameWorld.h.

Constructor & Destructor Documentation

◆ RayCastHitEntity()

DLLEXPORT Leviathan::RayCastHitEntity::RayCastHitEntity ( const NewtonBody *  ptr = nullptr,
const float &  tvar = 0.f,
RayCastData ownerptr = nullptr 
)

Definition at line 1531 of file GameWorld.cpp.

1532  :
1533  HitEntity(ptr),
1534  HitVariable(tvar)
1535 {
1536  if(ownerptr) {
1538  } else {
1539  HitLocation = (Float3)0;
1540  }
1541 }
const NewtonBody * HitEntity
Definition: GameWorld.h:70
float HitVariable
The distance from the start of the ray to the hit location.
Definition: GameWorld.h:73
Float3 BaseHitLocationCalcVar
Definition: GameWorld.h:87

Member Function Documentation

◆ DoesBodyMatchThisHit()

DLLEXPORT bool Leviathan::RayCastHitEntity::DoesBodyMatchThisHit ( NewtonBody *  other)

Definition at line 1548 of file GameWorld.cpp.

1549 {
1550  return HitEntity == other;
1551 }
const NewtonBody * HitEntity
Definition: GameWorld.h:70

◆ GetPosition()

DLLEXPORT Float3 Leviathan::RayCastHitEntity::GetPosition ( )

Definition at line 1553 of file GameWorld.cpp.

1554 {
1555  return HitLocation;
1556 }

◆ HasHit()

DLLEXPORT bool Leviathan::RayCastHitEntity::HasHit ( )

Definition at line 1543 of file GameWorld.cpp.

1544 {
1545  return HitEntity != nullptr;
1546 }
const NewtonBody * HitEntity
Definition: GameWorld.h:70

◆ operator=()

DLLEXPORT RayCastHitEntity & Leviathan::RayCastHitEntity::operator= ( const RayCastHitEntity other)

Definition at line 1558 of file GameWorld.cpp.

1560 {
1561  HitEntity = other.HitEntity;
1562  HitVariable = other.HitVariable;
1563  HitLocation = other.HitLocation;
1564 
1565  return *this;
1566 }
const NewtonBody * HitEntity
Definition: GameWorld.h:70
float HitVariable
The distance from the start of the ray to the hit location.
Definition: GameWorld.h:73

Member Data Documentation

◆ HitEntity

const NewtonBody* Leviathan::RayCastHitEntity::HitEntity

Stores the entity, typed as NewtonBody to make sure that user knows what should be compared with this

Definition at line 70 of file GameWorld.h.

◆ HitLocation

Float3 Leviathan::RayCastHitEntity::HitLocation

Definition at line 74 of file GameWorld.h.

◆ HitVariable

float Leviathan::RayCastHitEntity::HitVariable

The distance from the start of the ray to the hit location.

Definition at line 73 of file GameWorld.h.


The documentation for this class was generated from the following files: