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 2 minutesLast updated 13 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.

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.

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.