Method Interpolate
Interpolate(in RigidTransform, in RigidTransform, float)
Compute a simple interpolated transform for the graphical representation of a rigid body between previousTransform and currentTransform.
Because bodies' motion is often deflected during a physics step when there is a contact event, using this method can make bodies appear to change direction before a collision is actually visible.
Simulation: Graphical Interpolation:
O (t=2) O (t=2)
(t=0) O / (t=0) O o
\ / o o
\ O (t=1) O (t=1)
_________\/_________ ____________________
(Note that for cartoons, an animator would use squash and stretch to force a body to make contact even if it is technically not hitting on a specific frame.) See InterpolateUsingVelocity(in RigidTransform, in PhysicsVelocity, in PhysicsVelocity, in PhysicsMass, float, float) for an alternative approach.
Declaration
public static RigidTransform Interpolate(in RigidTransform previousTransform, in RigidTransform currentTransform, float normalizedTimeAhead)
Parameters
| Type | Name | Description |
|---|---|---|
| RigidTransform | previousTransform | The transform of the rigid body before physics stepped. |
| RigidTransform | currentTransform | The transform of the rigid body after physics has stepped (i.e., the value of its LocalTransform components). |
| float | normalizedTimeAhead | A value in the range [0, 1] indicating how many seconds the current elapsed time for graphics is ahead of the elapsed time when physics last stepped, as a proportion of the fixed timestep used by physics. |
Returns
| Type | Description |
|---|---|
| RigidTransform | An interpolated transform for a rigid body's graphical representation, suitable for constructing its |