Class ScopedPhysicsAccessor
Definition
- Assembly:
- Tizen.NUI.Physics2D.dll
Scoped accessor to the physics world.
Automatically locks the physics world with a mutex to prevent the integration step from running whilst the developer is accessing the world, e.g. to add/remove bodies or constraints, or to perform hit-test.
When it is disposed, the mutex is unlocked, and the integration step can resume.
Suggest that this is created with a "using" block:
using(accessor=physicsAdaptor.GetAccessor()) { var space = accessor.GetNative(); // Perform operations on space or bodies. } // automatically disposed.
public class ScopedPhysicsAccessor : IDisposable
- Inheritance
-
objectScopedPhysicsAccessor
Methods
View SourceDispose()
Disposes the Space object.
Declaration
public void Dispose()
Dispose(bool)
Dispose of this object. This ensures that the integration step is resumed
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
GetNative()
Get a weak handle to the native physics space. Disposing of this handle does not destroy the space.
Declaration
public SpaceRef GetNative()
Returns
Type | Description |
---|---|
SpaceRef |
HitTest(Vector3, Vector3, ShapeFilter, Vector3, out float)
Perform a hit test on the given physics world ray, with a possible filter. The ray can be created with PhysicsAdaptor.BuildPickingRay(). Returns a body if hit, along with the local pivot coordinates and the distance from the ray origin (usually camera)
Declaration
public Body HitTest(Vector3 rayFromWorld, Vector3 rayToWorld, ShapeFilter filter, Vector3 localPivot, out float distanceFromCamera)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | rayFromWorld | |
Vector3 | rayToWorld | |
ShapeFilter | filter | |
Vector3 | localPivot | |
float | distanceFromCamera |
Returns
Type | Description |
---|---|
Body |