文档

Unity Engine

Unity Engine

CreateShapeBatch

Create a batch of Circle shapes attached to this body.
阅读时间3 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

CreateShapeBatch(ReadOnlySpan<CircleGeometry>, PhysicsShapeDefinition, Allocator)

Create a batch of Circle shapes attached to this body.
public NativeArray<PhysicsShape> CreateShapeBatch(ReadOnlySpan<CircleGeometry> geometry, PhysicsShapeDefinition definition, Allocator allocator = Allocator.Temp)

Parameters

The shape geometry to use.

The shape definition to use.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<PhysicsShape>The created shapes. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

CreateShapeBatch(ReadOnlySpan<PolygonGeometry>, PhysicsShapeDefinition, Allocator)

Create a batch of Polygon shapes attached to this body.
public NativeArray<PhysicsShape> CreateShapeBatch(ReadOnlySpan<PolygonGeometry> geometry, PhysicsShapeDefinition definition, Allocator allocator = Allocator.Temp)

Parameters

The shape geometry to use.

The shape definition to use.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<PhysicsShape>The created shapes. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

CreateShapeBatch(ReadOnlySpan<CapsuleGeometry>, PhysicsShapeDefinition, Allocator)

Create a batch of Capsule shapes attached to this body.
public NativeArray<PhysicsShape> CreateShapeBatch(ReadOnlySpan<CapsuleGeometry> geometry, PhysicsShapeDefinition definition, Allocator allocator = Allocator.Temp)

Parameters

The shape geometry to use.

The shape definition to use.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<PhysicsShape>The created shapes. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

CreateShapeBatch(ReadOnlySpan<SegmentGeometry>, PhysicsShapeDefinition, Allocator)

Create a batch of Segment shapes attached to this body.
public NativeArray<PhysicsShape> CreateShapeBatch(ReadOnlySpan<SegmentGeometry> geometry, PhysicsShapeDefinition definition, Allocator allocator = Allocator.Temp)

Parameters

The shape geometry to use.

The shape definition to use.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<PhysicsShape>The created shapes. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

CreateShapeBatch(ReadOnlySpan<ChainSegmentGeometry>, PhysicsShapeDefinition, Allocator)

Create a batch of Chain Segment shapes attached to this body.
public NativeArray<PhysicsShape> CreateShapeBatch(ReadOnlySpan<ChainSegmentGeometry> geometry, PhysicsShapeDefinition definition, Allocator allocator = Allocator.Temp)

Parameters

The shape geometry to use.

The shape definition to use.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<PhysicsShape>The created shapes. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.