Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Clone

Clear any existing proxies and clone all PhysicsShape found in the specified PhysicsWorld. Each proxy created will have a user-handle assigned as _physicsHandle. This means you can get the referenced shape by using PhysicsShape.
Read time 3 minutesLast updated 11 days ago

Definition

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

Clone(PhysicsWorld, QueryFilter, bool)

Clear any existing proxies and clone all PhysicsShape found in the specified PhysicsWorld. Each proxy created will have a user-handle assigned as _physicsHandle. This means you can get the referenced shape by using PhysicsShape.
public int Clone(PhysicsWorld world, PhysicsQuery.QueryFilter filter, bool destroyExistingProxies = true)

Parameters

The world to find the PhysicsShape in. On a world-bound space this must be the world the space is bound to.

The filter to control what proxies are created.

destroyExistingProxies

Controls if any existing proxies are destroyed before cloning from the specified world. If false, care should be taken that any existing proxies refer to PhysicsShape otherwise a mix of user-handles will be present.

Returns

Type

Description

intHow many proxies were cloned.

Clone(PhysicsWorld, QueryFilter, PhysicsAABB, bool)

Clear any existing proxies and clone any PhysicsShape found in the specified PhysicsWorld overlapping the specified PhysicsAABB. Each proxy created will have a user-handle assigned as _physicsHandle. This means you can get the referenced shape by using PhysicsShape.
public int Clone(PhysicsWorld world, PhysicsQuery.QueryFilter filter, PhysicsAABB aabb, bool destroyExistingProxies = true)

Parameters

The world to find the PhysicsShape in. On a world-bound space this must be the world the space is bound to.

The filter to control what proxies are created.

The AABB used to discover PhysicsShape in the specified world. If the AABB size is size (default) then the whole world will be discovered.

destroyExistingProxies

Controls if any existing proxies are destroyed before cloning from the specified world. If false, care should be taken that any existing proxies refer to PhysicsShape otherwise a mix of user-handles will be present.

Returns

Type

Description

intHow many proxies were cloned.

Clone(QueryFilter, bool)

Clear any existing proxies and clone every PhysicsShape found in the world this space is bound to. Each proxy created will have a user-handle assigned as _physicsHandle. This only applies to a space bound to a world.
public int Clone(PhysicsQuery.QueryFilter filter, bool destroyExistingProxies = true)

Parameters

The filter to control what proxies are created.

destroyExistingProxies

Controls if any existing proxies are destroyed before cloning from the bound world. If false, care should be taken that any existing proxies refer to PhysicsShape otherwise a mix of user-handles will be present.

Returns

Type

Description

intHow many proxies were cloned.

Remarks

Clone(QueryFilter, PhysicsAABB, bool)

Clear any existing proxies and clone any PhysicsShape found in the world this space is bound to overlapping the specified PhysicsAABB. Each proxy created will have a user-handle assigned as _physicsHandle. This only applies to a space bound to a world.
public int Clone(PhysicsQuery.QueryFilter filter, PhysicsAABB aabb, bool destroyExistingProxies = true)

Parameters

The filter to control what proxies are created.

The AABB used to discover PhysicsShape in the bound world. If the AABB size is size (default) then the whole world will be discovered.

destroyExistingProxies

Controls if any existing proxies are destroyed before cloning from the bound world. If false, care should be taken that any existing proxies refer to PhysicsShape otherwise a mix of user-handles will be present.

Returns

Type

Description

intHow many proxies were cloned.

Remarks