|
static Vector2 | CalculateAccelerationToReachPoint (Vector2 deltaPosition, Vector2 targetVelocity, Vector2 currentVelocity, float forwardsAcceleration, float rotationSpeed, float maxSpeed, Vector2 forwardsVector) |
| Calculate an acceleration to move deltaPosition units and get there with approximately a velocity of targetVelocity. More...
|
|
static Vector2 | ClampVelocity (Vector2 velocity, float maxSpeed, float speedLimitFactor, bool slowWhenNotFacingTarget, bool preventMovingBackwards, Vector2 forward) |
| Clamps the velocity to the max speed and optionally the forwards direction. More...
|
|
static float | FilterRotationDirection (ref Vector2 state, ref Vector2 state2, Vector2 deltaPosition, float threshold, float deltaTime) |
|
◆ CalculateAccelerationToReachPoint()
static Vector2 CalculateAccelerationToReachPoint |
( |
Vector2 |
deltaPosition, |
|
|
Vector2 |
targetVelocity, |
|
|
Vector2 |
currentVelocity, |
|
|
float |
forwardsAcceleration, |
|
|
float |
rotationSpeed, |
|
|
float |
maxSpeed, |
|
|
Vector2 |
forwardsVector |
|
) |
| |
|
static |
Calculate an acceleration to move deltaPosition units and get there with approximately a velocity of targetVelocity.
◆ ClampVelocity()
static Vector2 ClampVelocity |
( |
Vector2 |
velocity, |
|
|
float |
maxSpeed, |
|
|
float |
speedLimitFactor, |
|
|
bool |
slowWhenNotFacingTarget, |
|
|
bool |
preventMovingBackwards, |
|
|
Vector2 |
forward |
|
) |
| |
|
static |
Clamps the velocity to the max speed and optionally the forwards direction.
- Parameters
-
velocity | Desired velocity of the character. In world units per second. |
maxSpeed | Max speed of the character. In world units per second. |
speedLimitFactor | Value between 0 and 1 which determines how much slower the character should move than normal. Normally 1 but should go to 0 when the character approaches the end of the path. |
slowWhenNotFacingTarget | Slow the character down if the desired velocity is not in the same direction as the forward vector. |
preventMovingBackwards | Prevent the velocity from being too far away from the forward direction of the character. |
forward | Forward direction of the character. Used together with the slowWhenNotFacingTarget parameter. |
Note that all vectors are 2D vectors, not 3D vectors.
- Returns
- The clamped velocity in world units per second.
◆ FilterRotationDirection()
static float FilterRotationDirection |
( |
ref Vector2 |
state, |
|
|
ref Vector2 |
state2, |
|
|
Vector2 |
deltaPosition, |
|
|
float |
threshold, |
|
|
float |
deltaTime |
|
) |
| |
|
static |
The documentation for this class was generated from the following file:
- /Users/arong/Unity/a-pathfinding-project/Assets/AstarPathfindingProject/Core/Misc/MovementUtilities.cs