Struct PhysicsVelocity | Unity Physics | 0.5.1-preview.2
docs.unity3d.com
    Show / Hide Table of Contents

    Struct PhysicsVelocity

    The velocity of a rigid body. If absent, the rigid body is static.

    Namespace: Unity.Physics
    Syntax
    public struct PhysicsVelocity : IComponentData

    Fields

    Angular

    The body's angular velocity in radians per second about each principal axis specified by Transform. In order to get or set world-space values, use and , respectively.

    Declaration
    public float3 Angular
    Field Value
    Type Description
    Unity.Mathematics.float3

    Linear

    The body's world-space linear velocity in units per second.

    Declaration
    public float3 Linear
    Field Value
    Type Description
    Unity.Mathematics.float3

    Methods

    CalculateVelocityToTarget(PhysicsMass, Translation, Rotation, RigidTransform, Single)

    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 Translation and Rotation values directly.

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

    The body's PhysicsMass component.

    Translation bodyPosition

    The body's Translation component.

    Rotation bodyOrientation

    The body's Rotation component.

    Unity.Mathematics.RigidTransform targetTransform

    The desired Translation and Rotation values the body should move to in world space.

    Single stepFrequency

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

    Returns
    Type Description
    PhysicsVelocity

    Extension Methods

    PhysicsComponentExtensions.GetLinearVelocity(PhysicsVelocity, PhysicsMass, Translation, Rotation, float3)
    PhysicsComponentExtensions.GetAngularVelocityWorldSpace(PhysicsVelocity, PhysicsMass, Rotation)
    PhysicsComponentExtensions.SetAngularVelocityWorldSpace(ref PhysicsVelocity, PhysicsMass, Rotation, float3)
    PhysicsComponentExtensions.ApplyExplosionForce(ref PhysicsVelocity, PhysicsMass, PhysicsCollider, Translation, Rotation, Single, float3, Single, Single, float3, CollisionFilter, Single, ForceMode)
    PhysicsComponentExtensions.ApplyExplosionForce(ref PhysicsVelocity, PhysicsMass, PhysicsCollider, Translation, Rotation, Single, float3, Single, Single, float3, Single, ForceMode)
    PhysicsComponentExtensions.ApplyImpulse(ref PhysicsVelocity, PhysicsMass, Translation, Rotation, float3, float3)
    PhysicsComponentExtensions.ApplyLinearImpulse(ref PhysicsVelocity, PhysicsMass, float3)
    PhysicsComponentExtensions.ApplyAngularImpulse(ref PhysicsVelocity, PhysicsMass, float3)
    PhysicsComponentExtensions.Integrate(PhysicsVelocity, PhysicsMass, Single, ref float3, ref quaternion)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023