Class MovementTracking
Component to track an object's displacement and rotation during an update
Implements
Namespace: nickmaltbie.OpenKCC.Environment.MovingGround
Assembly: cs.temp.dll.dll
Syntax
public class MovementTracking : MonoBehaviour, IMovingGround
Properties
ChangeAttitude
Finds the change in attitude (expressed as a quaternion) between the current and previous update. QFinal * Inv(QInitial)
Declaration
public Quaternion ChangeAttitude { get; }
Property Value
| Type | Description |
|---|---|
| Quaternion |
Displacement
Displacement between current and previous update
Declaration
public Vector3 Displacement { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
PreviousAttitude
Previously measured attitude of an object (previous frame)
Declaration
public Quaternion PreviousAttitude { get; }
Property Value
| Type | Description |
|---|---|
| Quaternion |
PreviousPosition
Previously measured position of an object (previous frame)
Declaration
public Vector3 PreviousPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Methods
AvoidTransferMomentum()
Should momentum be transferred to players when they leave this object.
Declaration
public bool AvoidTransferMomentum()
Returns
| Type | Description |
|---|---|
| Boolean |
FixedUpdate()
Component to track an object's displacement and rotation during an update
Declaration
public void FixedUpdate()
GetDisplacementAtPoint(Vector3)
Component to track an object's displacement and rotation during an update
Declaration
public virtual Vector3 GetDisplacementAtPoint(Vector3 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | point |
Returns
| Type | Description |
|---|---|
| Vector3 |
GetMovementWeight(Vector3, Vector3)
Get the weight of movement for a given player's velocity at a given point.
Declaration
public virtual float GetMovementWeight(Vector3 point, Vector3 playerVelocity)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | point | Point where player is standing on the object. |
| Vector3 | playerVelocity | Velocity of the player. |
Returns
| Type | Description |
|---|---|
| Single | Weight of player's attachment to the object given these parameters. Will be between 0 (not attached at all) and 1 (fully attached). |
GetTransferMomentumWeight(Vector3, Vector3)
Get the weight of movement of transfering momentum when a player leaves this object
Declaration
public virtual float GetTransferMomentumWeight(Vector3 point, Vector3 playerVelocity)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | point | Point where player is standing on the object. |
| Vector3 | playerVelocity | Velocity of the player. |
Returns
| Type | Description |
|---|---|
| Single | How much relative velocity teh player should retain when departing from the surface of this object via jump or fall. |
GetVelocityAtPoint(Vector3)
Get the velocity (in units per second) that the object is moving at a given point on the surface of the object (in world space).
Declaration
public virtual Vector3 GetVelocityAtPoint(Vector3 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | point | Point on the surface of the object (in world space). |
Returns
| Type | Description |
|---|---|
| Vector3 | Velocity that the object is moving at the point. |
ShouldAttach()
When following this object, should the player attach themselves to the object to follow it properly? This is important for rapidly moving objects. Additionally, if the object does not move but wants to push the player (such as a conveyer belt), then players should definitely not attach to the object.
Declaration
public bool ShouldAttach()
Returns
| Type | Description |
|---|---|
| Boolean |