docs.unity3d.com
    Show / Hide Table of Contents

    Class PhysicsWorldBuilder

    Utilities for building a physics world.

    Inheritance
    Object
    PhysicsWorldBuilder
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Physics.Systems
    Syntax
    [BurstCompile]
    public static class PhysicsWorldBuilder

    Methods

    BuildBroadphaseBVHImmediate(ref PhysicsWorld, Boolean, Single, float3)

    Build broadphase BoundingVolumeHierarchy of the specified PhysicsWorld (run immediately on the current thread)

    Declaration
    public static void BuildBroadphaseBVHImmediate(ref PhysicsWorld world, bool haveStaticBodiesChanged, float timeStep, float3 gravity)
    Parameters
    Type Name Description
    PhysicsWorld world

    [in,out] The world.

    Boolean haveStaticBodiesChanged

    True if have static bodies changed.

    Single timeStep

    The time step.

    float3 gravity

    The gravity.

    BuildPhysicsWorldImmediate(ref SystemState, ref PhysicsWorldData, Single, float3, UInt32)

    Fill specified PhysicsWorld with bodies and joints (using entities from specified queries) and build broadphase BoundingVolumeHierarchy (run immediately on the current thread). Needs a system to to update type handles of physics-related components.

    Declaration
    public static void BuildPhysicsWorldImmediate(ref SystemState systemState, ref PhysicsWorldData physicsData, float timeStep, float3 gravity, uint lastSystemVersion)
    Parameters
    Type Name Description
    SystemState systemState

    [in,out] State of the system.

    PhysicsWorldData physicsData

    [in,out] Information describing the physics.

    Single timeStep

    The time step.

    float3 gravity

    The gravity.

    UInt32 lastSystemVersion

    The last system version.

    BuildPhysicsWorldImmediate(ref PhysicsWorld, NativeReference<Int32>, in PhysicsWorldData.PhysicsWorldComponentHandles, Single, float3, UInt32, EntityQuery, EntityQuery, EntityQuery)

    Fill specified PhysicsWorld with bodies and joints (using entities from specified queries) and build broadphase BoundingVolumeHierarchy (run immediately on the current thread).

    Declaration
    public static void BuildPhysicsWorldImmediate(ref PhysicsWorld world, NativeReference<int> haveStaticBodiesChanged, in PhysicsWorldData.PhysicsWorldComponentHandles componentHandles, float timeStep, float3 gravity, uint lastSystemVersion, EntityQuery dynamicEntityGroup, EntityQuery staticEntityGroup, EntityQuery jointEntityGroup)
    Parameters
    Type Name Description
    PhysicsWorld world

    [in,out] The world.

    NativeReference<Int32> haveStaticBodiesChanged

    [in,out] The have static bodies changed.

    PhysicsWorldData.PhysicsWorldComponentHandles componentHandles

    The component handles.

    Single timeStep

    The time step.

    float3 gravity

    The gravity.

    UInt32 lastSystemVersion

    The last system version.

    EntityQuery dynamicEntityGroup

    Group the dynamic entity belongs to.

    EntityQuery staticEntityGroup

    Group the static entity belongs to.

    EntityQuery jointEntityGroup

    Group the joint entity belongs to.

    ScheduleBroadphaseBVHBuild(ref PhysicsWorld, NativeReference<Int32>.ReadOnly, in JobHandle, Single, Boolean, float3)

    Schedule jobs to build broadphase BoundingVolumeHierarchy of the specified PhysicsWorld.

    Declaration
    public static JobHandle ScheduleBroadphaseBVHBuild(ref PhysicsWorld world, NativeReference<int>.ReadOnly haveStaticBodiesChanged, in JobHandle inputDep, float timeStep, bool isBroadphaseBuildMultiThreaded, float3 gravity)
    Parameters
    Type Name Description
    PhysicsWorld world

    [in,out] The world.

    NativeReference.ReadOnly<> haveStaticBodiesChanged

    The have static bodies changed.

    JobHandle inputDep

    The input dependency.

    Single timeStep

    The time step.

    Boolean isBroadphaseBuildMultiThreaded

    True if is broadphase build multi threaded, false if not.

    float3 gravity

    The gravity.

    Returns
    Type Description
    JobHandle

    A JobHandle.

    SchedulePhysicsWorldBuild(ref SystemState, ref PhysicsWorld, ref NativeReference<Int32>, in PhysicsWorldData.PhysicsWorldComponentHandles, in JobHandle, Single, Boolean, float3, UInt32, EntityQuery, EntityQuery, EntityQuery)

    Schedule jobs to fill specified PhysicsWorld with bodies and joints (using entities from specified queries) and build broadphase BoundingVolumeHierarchy.

    Declaration
    public static JobHandle SchedulePhysicsWorldBuild(ref SystemState systemState, ref PhysicsWorld world, ref NativeReference<int> haveStaticBodiesChanged, in PhysicsWorldData.PhysicsWorldComponentHandles componentHandles, in JobHandle inputDep, float timeStep, bool isBroadphaseBuildMultiThreaded, float3 gravity, uint lastSystemVersion, EntityQuery dynamicEntityGroup, EntityQuery staticEntityQuery, EntityQuery jointEntityGroup)
    Parameters
    Type Name Description
    SystemState systemState

    [in,out] State of the system.

    PhysicsWorld world

    [in,out] The world.

    NativeReference<Int32> haveStaticBodiesChanged

    [in,out] The have static bodies changed.

    PhysicsWorldData.PhysicsWorldComponentHandles componentHandles

    The component handles.

    JobHandle inputDep

    The input dependency.

    Single timeStep

    The time step.

    Boolean isBroadphaseBuildMultiThreaded

    True if is broadphase build multi threaded, false if not.

    float3 gravity

    The gravity.

    UInt32 lastSystemVersion

    The last system version.

    EntityQuery dynamicEntityGroup

    Group the dynamic entity belongs to.

    EntityQuery staticEntityQuery

    The static entity query.

    EntityQuery jointEntityGroup

    Group the joint entity belongs to.

    Returns
    Type Description
    JobHandle

    A JobHandle.

    SchedulePhysicsWorldBuild(ref SystemState, ref PhysicsWorldData, in JobHandle, Single, Boolean, float3, UInt32)

    Schedule jobs to fill the PhysicsWorld in specified physicsData with bodies and joints (using entities from physicsData's queries) and build broadphase BoundingVolumeHierarchy. Needs a SystemState to update component handles.

    Declaration
    public static JobHandle SchedulePhysicsWorldBuild(ref SystemState systemState, ref PhysicsWorldData physicsData, in JobHandle inputDep, float timeStep, bool isBroadphaseBuildMultiThreaded, float3 gravity, uint lastSystemVersion)
    Parameters
    Type Name Description
    SystemState systemState

    [in,out] State of the system.

    PhysicsWorldData physicsData

    [in,out] Information describing the physics.

    JobHandle inputDep

    The input dependency.

    Single timeStep

    The time step.

    Boolean isBroadphaseBuildMultiThreaded

    True if is broadphase build multi threaded, false if not.

    float3 gravity

    The gravity.

    UInt32 lastSystemVersion

    The last system version.

    Returns
    Type Description
    JobHandle

    A JobHandle.

    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