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

    Show / Hide Table of Contents

    Method CalculateVelocityToTarget

    CalculateVelocityToTarget(in PhysicsMass, in float3, in quaternion, in RigidTransform, in float)

    Create a PhysicsVelocity required to move a body to a target position and orientation. Use this method to control kinematic bodies directly if they need to generate contact events when moving to their new positions. If you need to teleport kinematic bodies you can simply set their LocalTransform component values directly.

    Declaration
    public static PhysicsVelocity CalculateVelocityToTarget(in PhysicsMass bodyMass, in float3 bodyPosition, in quaternion bodyOrientation, in RigidTransform targetTransform, in float stepFrequency)
    Parameters
    Type Name Description
    PhysicsMass bodyMass

    The body's PhysicsMass component.

    float3 bodyPosition

    The body's world-space position.

    quaternion bodyOrientation

    The body's world-space rotation.

    RigidTransform targetTransform

    The desired translation and rotation values the body should move to in world space.

    float stepFrequency

    The step frequency in the simulation where the body's motion is solved (i.e., 1 / FixedDeltaTime).

    Returns
    Type Description
    PhysicsVelocity

    The calculated velocity to target.

    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)