Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
PathConstraintPath Class Referenceabstract

The path for a path constraint. It allows attaching two bodies to each other while giving the second body the freedom to move along a path relative to the first. More...

#include <PathConstraintPath.h>

Inheritance diagram for PathConstraintPath:
SerializableObject RefTarget< PathConstraintPath > NonCopyable PathConstraintPathHermite

Public Types

using PathResult = Result< Ref< PathConstraintPath > >
 

Public Member Functions

virtual ~PathConstraintPath () override=default
 Virtual destructor to ensure that derived types get their destructors called.
 
virtual float GetPathMaxFraction () const =0
 Gets the max fraction along the path. I.e. sort of the length of the path.
 
virtual float GetClosestPoint (Vec3Arg inPosition, float inFractionHint) const =0
 
virtual void GetPointOnPath (float inFraction, Vec3 &outPathPosition, Vec3 &outPathTangent, Vec3 &outPathNormal, Vec3 &outPathBinormal) const =0
 
void SetIsLooping (bool inIsLooping)
 If the path is looping or not. If a path is looping, the first and last point are automatically connected to each other. They should not be the same points.
 
bool IsLooping () const
 
void DrawPath (DebugRenderer *inRenderer, RMat44Arg inBaseTransform) const
 Draw the path relative to inBaseTransform. Used for debug purposes.
 
virtual void SaveBinaryState (StreamOut &inStream) const
 Saves the contents of the path in binary form to inStream.
 
- Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Constructor.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Public Member Functions inherited from RefTarget< PathConstraintPath >
 RefTarget ()=default
 Constructor.
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator.
 
uint32 GetRefCount () const
 Get current refcount of this object.
 
void AddRef () const
 Add or release a reference to this object.
 
void Release () const
 

Static Public Member Functions

static PathResult sRestoreFromBinaryState (StreamIn &inStream)
 Creates a Shape of the correct type and restores its contents from the binary stream inStream.
 
- Static Public Member Functions inherited from RefTarget< PathConstraintPath >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION.
 

Protected Member Functions

virtual void RestoreBinaryState (StreamIn &inStream)
 This function should not be called directly, it is used by sRestoreFromBinaryState.
 

Additional Inherited Members

- Protected Attributes inherited from RefTarget< PathConstraintPath >
atomic< uint32mRefCount
 Current reference count.
 
- Static Protected Attributes inherited from RefTarget< PathConstraintPath >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded.
 

Detailed Description

The path for a path constraint. It allows attaching two bodies to each other while giving the second body the freedom to move along a path relative to the first.

Member Typedef Documentation

◆ PathResult

Constructor & Destructor Documentation

◆ ~PathConstraintPath()

virtual PathConstraintPath::~PathConstraintPath ( )
overridevirtualdefault

Virtual destructor to ensure that derived types get their destructors called.

Member Function Documentation

◆ DrawPath()

void PathConstraintPath::DrawPath ( DebugRenderer inRenderer,
RMat44Arg  inBaseTransform 
) const

Draw the path relative to inBaseTransform. Used for debug purposes.

◆ GetClosestPoint()

virtual float PathConstraintPath::GetClosestPoint ( Vec3Arg  inPosition,
float  inFractionHint 
) const
pure virtual

Get the globally closest point on the curve (Could be slow!)

Parameters
inPositionPosition to find closest point for
inFractionHintLast known fraction along the path (can be used to speed up the search)
Returns
Fraction of closest point along the path

Implemented in PathConstraintPathHermite.

◆ GetPathMaxFraction()

virtual float PathConstraintPath::GetPathMaxFraction ( ) const
pure virtual

Gets the max fraction along the path. I.e. sort of the length of the path.

Implemented in PathConstraintPathHermite.

◆ GetPointOnPath()

virtual void PathConstraintPath::GetPointOnPath ( float  inFraction,
Vec3 outPathPosition,
Vec3 outPathTangent,
Vec3 outPathNormal,
Vec3 outPathBinormal 
) const
pure virtual

Given the fraction along the path, get the point, tangent and normal.

Parameters
inFractionFraction along the path [0, GetPathMaxFraction()].
outPathPositionReturns the closest position to inSearchPosition on the path.
outPathTangentReturns the tangent to the path at outPathPosition (the vector that follows the direction of the path)
outPathNormalReturn the normal to the path at outPathPosition (a vector that's perpendicular to outPathTangent)
outPathBinormalReturns the binormal to the path at outPathPosition (a vector so that normal cross tangent = binormal)

Implemented in PathConstraintPathHermite.

◆ IsLooping()

bool PathConstraintPath::IsLooping ( ) const
inline

◆ RestoreBinaryState()

void PathConstraintPath::RestoreBinaryState ( StreamIn inStream)
protectedvirtual

This function should not be called directly, it is used by sRestoreFromBinaryState.

Reimplemented in PathConstraintPathHermite.

◆ SaveBinaryState()

void PathConstraintPath::SaveBinaryState ( StreamOut inStream) const
virtual

Saves the contents of the path in binary form to inStream.

Reimplemented in PathConstraintPathHermite.

◆ SetIsLooping()

void PathConstraintPath::SetIsLooping ( bool  inIsLooping)
inline

If the path is looping or not. If a path is looping, the first and last point are automatically connected to each other. They should not be the same points.

◆ sRestoreFromBinaryState()

PathConstraintPath::PathResult PathConstraintPath::sRestoreFromBinaryState ( StreamIn inStream)
static

Creates a Shape of the correct type and restores its contents from the binary stream inStream.


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