Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PhysicsSpace

struct in Unity.U2D.Physics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides the ability to store and query information in a spatial database.

Properties

Property Description
isValid Check if a Physics Space is valid.
memoryAllocated Get the total memory allocated for the space, in bytes.
proxyCount Get the proxy count in the space.
rootAABB Get the root bounds that contain all the AABB proxies.
sourceWorld Get the world this space is bound to, or a default (invalid) world if the space is not bound. A space is bound by creating it with the world overload of Create.

Public Methods

Method Description
CastRay Find proxies that intersect the specified ray. The results indicate that the proxy AABB intersect the specified cast ray, in no specific order.
CastShape Find proxies that intersect the specified shape. The results indicate that the proxy AABB intersect the specified cast shape, in no specific order.
ClearProxies Clear all space proxies. You should no longer use any previously returned ProxyHandle as they may be invalid or direct to the wrong proxy in the future. The space will continue with a similar proxy capacity therefore if full de-allocation is required, the space should be destroyed and a new one created.
Clone Clear any existing proxies and clone all PhysicsShape found in the specified PhysicsWorld. Each proxy created will have a user-handle assigned as PhysicsShape.physicsHandle. This means you can get the referenced shape by using PhysicsShape.PhysicsShape.
CreateProxy Create a space proxy.
CreateProxyShapes Create one proxy per shape, taking each proxy AABB, categories and user handle directly from the shape. This only applies to a space bound to a world, and every shape must be a live shape in that world.
Destroy Destroy the Physics Space.
DestroyProxy Destroy a space proxy.
GetBatchProxyAABB Get a batch of proxy AABB. If any proxy handle in the batch is invalid, no results are returned and an empty array is produced.
GetBatchProxyCategories Get a batch of proxy categories. If any proxy handle in the batch is invalid, no results are returned and an empty array is produced.
GetBatchProxyShapes Get a batch of proxy user handles as shapes, valid only on a space bound to a world. On a bound space every proxy user handle is a shape, so each is returned as a shape that the caller can check for validity. This only applies to a space bound to a world.
GetBatchProxyUserHandle Get a batch of proxy user handles. If any proxy handle in the batch is invalid, no results are returned and an empty array is produced.
GetProxyAABB Set the proxy physics AABB.
GetProxyCategories Get the proxy categories.
GetProxyUserHandle Get the proxy user handle.
OverlapAABB Find proxies that overlap the specified AABB. The results indicate that the proxy AABB overlap the specified AABB, in no specific order.
OverlapPoint Find proxies that overlap the specified point. The results indicate that the proxy AABB overlap the specified point, in no specific order.
SetBatchProxyAABB Set a batch of proxy AABB, where the AABB at each index is set on the corresponding proxy at the same index. The two spans must be the same length. Any invalid proxy handle or AABB in the batch is skipped and reported with a single warning.
SetBatchProxyCategories Set a batch of proxy categories, where the categories at each index are set on the corresponding proxy at the same index. The two spans must be the same length. This can be an expensive operation as all ancestors need to be recalculated. Any invalid proxy handle in the batch is skipped and reported with a single warning.
SetProxyAABB Set the proxy AABB.
SetProxyCategories Set the proxy categories. This can be an expensive operation as all ancestors need to be recalculated.
SetProxyUserHandle Set the proxy user handle. On a world-bound space the user handle must be a live shape in the bound world.
SyncShapes Refresh every proxy from its shape, updating each proxy AABB and categories to match the live shape. This only applies to a space bound to a world. A proxy whose shape has been destroyed since it was added is skipped and reported with a single warning.

Static Methods

Method Description
Create Create a Physics Space.
DestroyAll Destroy all active Physics Space.
GetSpaces Get all the currently active spaces.