Class PhysicsAdaptor
Definition
- Namespace:
- Tizen.NUI.Physics2D
- Assembly:
- Tizen.NUI.Physics2D.dll
Adaptor to manage access to the physics world and pairing actors and physics
bodies, plus some translation methods to/from the physics space and dali space.
Also manages a debug renderer that may utilize the physics engine debug.
It is up to the developer to retrieve the root actor and parent it into the scene.
public class PhysicsAdaptor : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
- Inheritance
-
- Implements
-
System.IDisposable
Constructors
View Source
PhysicsAdaptor(Matrix, Vector2)
Initialize the physics system.
Transformation matrix from NUI space to the Physics Space
Size of the root layer that the adaptor creates
Declaration
public PhysicsAdaptor(Matrix transform, Vector2 size)
Parameters
View Source
PhysicsAdaptor(PhysicsAdaptor)
Declaration
public PhysicsAdaptor(PhysicsAdaptor adaptor)
Parameters
Properties
View Source
DebugState
Property to handle the debug state of the adaptor
Declaration
public DebugState DebugState { get; set; }
Property Value
View Source
IntegrationState
Property to handle the IntegrationState of the adaptor
Declaration
public IntegrationState IntegrationState { get; set; }
Property Value
View Source
Timestep
The time that the integration step notionally takes.
Declaration
public float Timestep { get; set; }
Property Value
Methods
View Source
AddViewToBody(View, Body)
Add a view to the body. The view will be used to render the body. It is parented onto the root layer.
The physics body should be added to the physics space by the user.
Declaration
public PhysicsActor AddViewToBody(View view, Body body)
Parameters
Type |
Name |
Description |
View |
view |
|
Body |
body |
|
Returns
View Source
BuildPickingRay(Vector3, Vector3, Vector3, Vector3)
Convert a touch point into a picking ray in the Physics space.
Declaration
public void BuildPickingRay(Vector3 origin, Vector3 direction, Vector3 rayFromWorld, Vector3 rayToWorld)
Parameters
View Source
ConvertVectorFromPhysicsSpace(Vector3)
Converts a vector (not a point) in physics space to NUI space.
Declaration
public Vector3 ConvertVectorFromPhysicsSpace(Vector3 vector)
Parameters
Type |
Name |
Description |
Vector3 |
vector |
|
Returns
View Source
ConvertVectorToPhysicsSpace(Vector3)
Converts a vector (not a point) in NUI space to Physics space
Declaration
public Vector3 ConvertVectorToPhysicsSpace(Vector3 vector)
Parameters
Type |
Name |
Description |
Vector3 |
vector |
|
Returns
View Source
CreateDebugLayer(Window)
The debug layer uses a drawable actor and the debug features of the native physics engine
to render any debug graphics for the physics bodies.
This layer needs to be created before setting the DebugState has any effect.
Declaration
public Layer CreateDebugLayer(Window window)
Parameters
Type |
Name |
Description |
Window |
window |
|
Returns
View Source
CreateSyncPoint()
A sync point is necessary to synchronize Async calls in the update thread.
Any use of the PhysicsActor.AsyncNNN calls will require this API to be called.
Declaration
public void CreateSyncPoint()
View Source
Dispose(DisposeTypes)
Dispose the PhysicsAdaptor
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Overrides
View Source
GetAccessor()
Return an accessor to the physics world.
Internally, this locks a mutex to prevent the integration step from running,
this will also block the Update thread. It is important that this accessor
is disposed of when not needed to restart the update thread. (Suggest use of
"using" block).
Declaration
public ScopedPhysicsAccessor GetAccessor()
Returns
View Source
GetPhysicsActor(Body)
Retrieve a PhysicsActor given a physics body.
If there is no associated PhysicsActor, this will return null.
Declaration
public PhysicsActor GetPhysicsActor(Body body)
Parameters
Type |
Name |
Description |
Body |
body |
|
Returns
View Source
GetRootLayer()
Declaration
public Layer GetRootLayer()
Returns
View Source
ProjectPoint(Vector3, Vector3, float)
Project a point from the origin (in NUI space) a distance along the direction
vector (in NUI space) and returns the projected point in physics space.
Declaration
public Vector3 ProjectPoint(Vector3 origin, Vector3 direction, float distance)
Parameters
Returns
View Source
ReleaseSwigCPtr(HandleRef)
Declaration
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type |
Name |
Description |
System.Runtime.InteropServices.HandleRef |
swigCPtr |
|
View Source
RemoveViewFromBody(PhysicsActor)
This will unparent the View from the root layer, and dis-associate it
from the physics body. It is the responsibility of the user to remove
the physics body from the world.
Declaration
public void RemoveViewFromBody(PhysicsActor actor)
Parameters
View Source
Change the transform matrix or the size of the root view
Declaration
public void SetTransformAndSize(Matrix transform, Vector2 size)
Parameters
View Source
Transform a position in Physics space to NUI space
Declaration
public Vector3 TransformPositionFromPhysicsSpace(Vector3 position)
Parameters
Type |
Name |
Description |
Vector3 |
position |
|
Returns
View Source
Transforms a position from NUI space to physics space
Declaration
public Vector3 TransformPositionToPhysicsSpace(Vector3 position)
Parameters
Type |
Name |
Description |
Vector3 |
position |
|
Returns
View Source
Convert a rotation in physics space into NUI space
Declaration
public Rotation TransformRotationFromPhysicsSpace(Rotation rotation)
Parameters
Returns
View Source
Transform a rotation from NUI to physics space
Declaration
public Rotation TransformRotationToPhysicsSpace(Rotation rotation)
Parameters
Returns
Implements
System.IDisposable
Extension Methods