{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method InterpolateUsingVelocity | Unity Physics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method InterpolateUsingVelocity

    InterpolateUsingVelocity(in RigidTransform, in PhysicsVelocity, in PhysicsVelocity, in PhysicsMass, float, float)

    Compute an interpolated transform for the graphical representation of a rigid body between its previous transform and current transform, integrating forward using an interpolated velocity value. This method tries to achieve a compromise between the visual artifacts of Interpolate(in RigidTransform, in RigidTransform, float) and Extrapolate(in RigidTransform, in PhysicsVelocity, in PhysicsMass, float). While integrating forward using previousVelocity alone would exhibit behavior similar to Extrapolate(in RigidTransform, in PhysicsVelocity, in PhysicsMass, float), doing so in conjunction with previousTransform results in smoother motion for small velocity changes. Collisions can still appear premature when physics has a low tick rate, however, as when using Interpolate(in RigidTransform, in RigidTransform, float).

    Declaration
    public static RigidTransform InterpolateUsingVelocity(in RigidTransform previousTransform, in PhysicsVelocity previousVelocity, in PhysicsVelocity currentVelocity, in PhysicsMass mass, float timeAhead, float normalizedTimeAhead)
    Parameters
    Type Name Description
    RigidTransform previousTransform

    The transform of the rigid body before physics stepped.

    PhysicsVelocity previousVelocity

    The velocity of the rigid body before physics stepped.

    PhysicsVelocity currentVelocity

    The velocity of the rigid body after physics has stepped (i.e., the value of its PhysicsVelocity component).

    PhysicsMass mass

    The body's PhysicsMass component.

    float timeAhead

    A value indicating how many seconds the current elapsed time for graphics is ahead of the elapsed time when physics last stepped.

    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 LocalToWorld matrix before rendering. See also BuildLocalToWorld(int, RigidTransform, float, bool, NativeArray<PostTransformMatrix>).

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)