Jolt Physics
A multi core friendly Game Physics Engine
|
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>
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 |
RefTarget & | operator= (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< uint32 > | mRefCount |
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. | |
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.
|
overridevirtualdefault |
Virtual destructor to ensure that derived types get their destructors called.
void PathConstraintPath::DrawPath | ( | DebugRenderer * | inRenderer, |
RMat44Arg | inBaseTransform ) const |
Draw the path relative to inBaseTransform. Used for debug purposes.
|
pure virtual |
Get the globally closest point on the curve (Could be slow!)
inPosition | Position to find closest point for |
inFractionHint | Last known fraction along the path (can be used to speed up the search) |
Implemented in PathConstraintPathHermite.
Gets the max fraction along the path. I.e. sort of the length of the path.
Implemented in PathConstraintPathHermite.
|
pure virtual |
Given the fraction along the path, get the point, tangent and normal.
inFraction | Fraction along the path [0, GetPathMaxFraction()]. |
outPathPosition | Returns the closest position to inSearchPosition on the path. |
outPathTangent | Returns the tangent to the path at outPathPosition (the vector that follows the direction of the path) |
outPathNormal | Return the normal to the path at outPathPosition (a vector that's perpendicular to outPathTangent) |
outPathBinormal | Returns the binormal to the path at outPathPosition (a vector so that normal cross tangent = binormal) |
Implemented in PathConstraintPathHermite.
|
inline |
This function should not be called directly, it is used by sRestoreFromBinaryState.
Reimplemented in PathConstraintPathHermite.
Saves the contents of the path in binary form to inStream.
Reimplemented in PathConstraintPathHermite.
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.
|
static |
Creates a Shape of the correct type and restores its contents from the binary stream inStream.