docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class PhysicsWorldExtensions

    Utility functions acting on a physics world.

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

    Methods

    ApplyAngularImpulse(PhysicsWorld, int, float3)

    Apply an angular impulse to a rigidBodyIndex (in world space)

    Declaration
    public static void ApplyAngularImpulse(this PhysicsWorld world, int rigidBodyIndex, float3 angularImpulse)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 angularImpulse

    The angular impulse.

    ApplyImpulse(PhysicsWorld, int, float3, float3)

    Apply an impulse to a rigid body at a point (in world space)

    Declaration
    public static void ApplyImpulse(this PhysicsWorld world, int rigidBodyIndex, float3 linearImpulse, float3 point)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 linearImpulse

    The linear impulse.

    float3 point

    The point.

    ApplyLinearImpulse(PhysicsWorld, int, float3)

    Apply a linear impulse to a rigid body (in world space)

    Declaration
    public static void ApplyLinearImpulse(this PhysicsWorld world, int rigidBodyIndex, float3 linearImpulse)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 linearImpulse

    The linear impulse.

    CalculateVelocityToTarget(PhysicsWorld, int, RigidTransform, float, out float3, out float3)

    Calculate a linear and angular velocity required to move the given rigid body to the given target transform in the given time step.

    Declaration
    public static void CalculateVelocityToTarget(this PhysicsWorld world, int rigidBodyIndex, RigidTransform targetTransform, float timestep, out float3 requiredLinearVelocity, out float3 requiredAngularVelocity)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    RigidTransform targetTransform

    Target transform.

    float timestep

    The timestep.

    float3 requiredLinearVelocity

    [out] The required linear velocity.

    float3 requiredAngularVelocity

    [out] The required angular velocity.

    GetAngularVelocity(in PhysicsWorld, int)

    Get the angular velocity of a rigid body around it's center of mass (in world space)

    Declaration
    public static float3 GetAngularVelocity(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    float3

    The angular velocity.

    GetCenterOfMass(in PhysicsWorld, int)

    Get the Rigid Bodies Center of Mass (in World Space)

    Declaration
    public static float3 GetCenterOfMass(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    float3

    The center of mass.

    GetCollisionFilter(in PhysicsWorld, int)

    An in PhysicsWorld extension method that gets collision filter.

    Declaration
    public static CollisionFilter GetCollisionFilter(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    CollisionFilter

    The collision filter.

    GetEffectiveMass(in PhysicsWorld, int, float3, float3)

    Get the effective mass of a Rigid Body in a given direction and from a particular point (in World Space)

    Declaration
    public static float GetEffectiveMass(this in PhysicsWorld world, int rigidBodyIndex, float3 impulse, float3 point)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 impulse

    The impulse.

    float3 point

    The point.

    Returns
    Type Description
    float

    The effective mass.

    GetLinearVelocity(in PhysicsWorld, int)

    Get the linear velocity of a rigid body (in world space)

    Declaration
    public static float3 GetLinearVelocity(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    float3

    The linear velocity.

    GetLinearVelocity(in PhysicsWorld, int, float3)

    Get the linear velocity of a rigid body at a given point (in world space)

    Declaration
    public static float3 GetLinearVelocity(this in PhysicsWorld world, int rigidBodyIndex, float3 point)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 point

    The point.

    Returns
    Type Description
    float3

    The linear velocity.

    GetMass(in PhysicsWorld, int)

    An in PhysicsWorld extension method that gets the mass.

    Declaration
    public static float GetMass(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    float

    The mass.

    GetPosition(in PhysicsWorld, int)

    An in PhysicsWorld extension method that gets a position of a body in World Space.

    Declaration
    public static float3 GetPosition(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    float3

    The position.

    GetRotation(in PhysicsWorld, int)

    An in PhysicsWorld extension method that gets a rotation.

    Declaration
    public static quaternion GetRotation(this in PhysicsWorld world, int rigidBodyIndex)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    Returns
    Type Description
    quaternion

    The rotation.

    SetAngularVelocity(PhysicsWorld, int, float3)

    Set the angular velocity of a rigid body (in world space)

    Declaration
    public static void SetAngularVelocity(this PhysicsWorld world, int rigidBodyIndex, float3 angularVelocity)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 angularVelocity

    The angular velocity.

    SetLinearVelocity(PhysicsWorld, int, float3)

    Set the linear velocity of a rigid body (in world space)

    Declaration
    public static void SetLinearVelocity(this PhysicsWorld world, int rigidBodyIndex, float3 linearVelocity)
    Parameters
    Type Name Description
    PhysicsWorld world

    The world to act on.

    int rigidBodyIndex

    Zero-based index of the rigid body.

    float3 linearVelocity

    The linear velocity.

    In This Article
    Back to top
    Copyright © 2024 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)