Photon Fusion 2.1.1

FloatTrajectoryPredictor Class Reference

Static class with helper methods to predict the expected position and velocity of a dynamic body on a given tick in the future. More...

Static Public Member Functions

static Vector2 PredictPosition (float dt, float ticksAhead, Vector2 initPos, Vector2 initVel, Vector2 gravity, float drag)
 Predicts the expected position of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.
static Vector3 PredictPosition (float dt, float ticksAhead, Vector3 initPos, Vector3 initVel, Vector3 gravity, float drag)
 Predicts the expected position of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.
static Vector2 PredictVelocity (float dt, float ticksAhead, Vector2 initVel, Vector2 gravity, float drag)
 Predicts the expected velocity of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.
static Vector3 PredictVelocity (float dt, float ticksAhead, Vector3 initVel, Vector3 gravity, float drag)
 Predicts the expected velocity of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.

Detailed Description

Static class with helper methods to predict the expected position and velocity of a dynamic body on a given tick in the future.

Member Function Documentation

◆ PredictPosition() [1/2]

Vector2 PredictPosition ( float dt,
float ticksAhead,
Vector2 initPos,
Vector2 initVel,
Vector2 gravity,
float drag )
static

Predicts the expected position of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.

Parameters
dtDelta time of each integration step.
ticksAheadHow many ticks ahead the prediction will be, where each tick is dt long.
initPosThe initial position of the object, before the prediction.
initVelThe initial velocity of the object, before the prediction.
gravityThe gravity force which the object is subject to.
dragDrag factor of the dynamic body.
Returns
The predicted position.
Exceptions
InvalidOperationExceptionif ticksAhead is smaller than 0.

◆ PredictPosition() [2/2]

Vector3 PredictPosition ( float dt,
float ticksAhead,
Vector3 initPos,
Vector3 initVel,
Vector3 gravity,
float drag )
static

Predicts the expected position of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.

Parameters
dtDelta time of each integration step.
ticksAheadHow many ticks ahead the prediction will be, where each tick is dt long.
initPosThe initial position of the object, before the prediction.
initVelThe initial velocity of the object, before the prediction.
gravityThe gravity force which the object is subject to.
dragDrag factor of the dynamic body.
Returns
The predicted position.
Exceptions
InvalidOperationExceptionif ticksAhead is smaller than 0.

◆ PredictVelocity() [1/2]

Vector2 PredictVelocity ( float dt,
float ticksAhead,
Vector2 initVel,
Vector2 gravity,
float drag )
static

Predicts the expected velocity of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.

Parameters
dtDelta time of each integration step.
ticksAheadHow many ticks ahead the prediction will be, where each tick is dt long.
initVelThe initial velocity of the object, before the prediction.
gravityThe gravity force which the object is subject to.
dragDrag factor of the dynamic body.
Returns
The predicted velocity.
Exceptions
InvalidOperationExceptionif ticksAhead is smaller than 0.

◆ PredictVelocity() [2/2]

Vector3 PredictVelocity ( float dt,
float ticksAhead,
Vector3 initVel,
Vector3 gravity,
float drag )
static

Predicts the expected velocity of a dynamic physics body on a given tick in the future, taking into consideration gravity and the drag force.

Parameters
dtDelta time of each integration step.
ticksAheadHow many ticks ahead the prediction will be, where each tick is dt long.
initVelThe initial velocity of the object, before the prediction.
gravityThe gravity force which the object is subject to.
dragDrag factor of the dynamic body.
Returns
The predicted velocity.
Exceptions
InvalidOperationExceptionif ticksAhead is smaller than 0.