Version: Unity 6.6 Alpha (6000.6)
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.

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.
Destroy Destroy the Physics Space.
DestroyProxy Destroy a space proxy.
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.
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.

Static Methods

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