{!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} Class GraphicalSmoothingUtility | Unity Physics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GraphicalSmoothingUtility

    Utility functions for smoothing the motion of rigid bodies' graphical representations when physics steps at a lower frequency than rendering.

    Inheritance
    object
    GraphicalSmoothingUtility
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Physics.GraphicsIntegration
    Assembly: solution.dll
    Syntax
    public static class GraphicalSmoothingUtility

    Methods

    Name Description
    BuildLocalToWorld(int, RigidTransform, float, bool, NativeArray<PostTransformMatrix>)

    Construct a LocalToWorld matrix for a rigid body's graphical representation.

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

    Compute a simple extrapolated transform for the graphical representation of a rigid body using its currentTransform and currentVelocity. Because bodies' motion may change the next time physics steps (e.g., as the result of a collision), using this method can mis-predict their future locations, causing them to appear to snap into place the next time physics steps. It generally results in a solid contact and kick from collisions, albeit with some interpenetration, as well as slight jitter on small, smooth velocity changes (e.g., the top of a parabolic arc).

    Simulation:                Graphical Extrapolation:
    
                  O (t=2)                     O (t=2)
    (t=0) O      /               (t=0) O     o
           \    /                       o   o
            \  O (t=1)                   o O (t=1)
    _________\/_________       ___________o________
                                           o
    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.

    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).

    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)