Class SpaceRef
Definition
- Namespace:
- Tizen.NUI.Physics2D.Chipmunk
- Assembly:
- Tizen.NUI.Physics2D.dll
Weak reference to a Space.
Gives access to the Native cpSpace API without enforcing
ownership of the space (which may instead be owned by the
rendering library)
- Inheritance
-
Properties
View Source
Bodies
Get all bodies in the space.
Declaration
public IReadOnlyList<Body> Bodies { get; }
Property Value
Type |
Description |
IReadOnlyList<><Body> |
|
View Source
CollisionBias
Determines how fast overlapping shapes are pushed apart.
Declaration
public double CollisionBias { get; set; }
Property Value
View Source
CollisionPersistence
Number of frames that contact information should persist. Defaults to 3. There is
probably never a reason to change this value.
Declaration
public int CollisionPersistence { get; set; }
Property Value
View Source
CollisionSlop
Amount of encouraged penetration between colliding shapes. This is used to reduce
oscillating contacts and keep the collision cache warm. Defaults to 0.1. If you have
poor simulation quality, increase this number as much as possible without allowing
visible amounts of overlap.
Declaration
public double CollisionSlop { get; set; }
Property Value
View Source
Constraints
Get all constraints in the space.
Declaration
public IReadOnlyList<Constraint> Constraints { get; }
Property Value
View Source
CurrentTimeStep
Returns the current (or most recent) time step used with the given space.
Useful from callbacks if your time step is not a compile-time global.
Declaration
public double CurrentTimeStep { get; }
Property Value
View Source
Damping
Damping rate expressed as the fraction of velocity that bodies retain each second. A
value of 0.9 would mean that each body's velocity will drop 10% per second. The default
value is 1.0, meaning no damping is applied. Note: This damping value is different than
those of DampedSpring and DampedRotarySpring.
Declaration
public double Damping { get; set; }
Property Value
View Source
Data
Declaration
public object Data { get; set; }
Property Value
View Source
DynamicBodies
Get dynamic bodies in the space.
Declaration
public IReadOnlyList<Body> DynamicBodies { get; }
Property Value
Type |
Description |
IReadOnlyList<><Body> |
|
View Source
Gravity
Gravity to pass to rigid bodies when integrating velocity.
Declaration
public Vect Gravity { get; set; }
Property Value
View Source
IdleSpeedThreshold
Speed threshold for a body to be considered idle. The default value of 0 means to let
the space guess a good threshold based on gravity.
Declaration
public double IdleSpeedThreshold { get; set; }
Property Value
View Source
IsLocked
Returns true from inside a callback when objects cannot be added/removed.
Declaration
public bool IsLocked { get; }
Property Value
View Source
Iterations
Number of iterations to use in the impulse solver to solve contacts and other
constraints.
Declaration
public int Iterations { get; set; }
Property Value
View Source
Shapes
Get all shapes in the space.
Declaration
public IReadOnlyList<Shape> Shapes { get; }
Property Value
Type |
Description |
IReadOnlyList<><Shape> |
|
View Source
SleepTimeThreshold
Time a group of bodies must remain idle in order to fall asleep. Enabling sleeping also
implicitly enables the the contact graph. The default value of infinity disables the
sleeping algorithm.
Declaration
public double SleepTimeThreshold { get; set; }
Property Value
View Source
StaticBody
The Space provided static body for a given Space.
Declaration
public Body StaticBody { get; }
Property Value
Methods
View Source
AddBody(Body)
Add a rigid body to the simulation.
Declaration
public void AddBody(Body body)
Parameters
Type |
Name |
Description |
Body |
body |
|
View Source
AddConstraint(Constraint)
Add a constraint to the simulation.
Declaration
public void AddConstraint(Constraint constraint)
Parameters
View Source
AddPostStepCallback(Action<Space, object, object>, object, object)
Schedule a post-step callback to be called when Step(double) finishes. You can
only register one callback per unique value for key
. Returns true
only if key
has never been scheduled before. It's possible to pass
null for callback
if you only want to mark key
as
being used.
Declaration
public bool AddPostStepCallback(Action<Space, object, object> callback, object key, object data)
Parameters
Type |
Name |
Description |
Action<, , ><Space, object, object> |
callback |
|
object |
key |
|
object |
data |
|
Returns
View Source
AddShape(Shape)
Add a collision shape to the simulation.
Declaration
public void AddShape(Shape shape)
Parameters
Type |
Name |
Description |
Shape |
shape |
|
View Source
BoundBoxQuery(BoundingBox, ShapeFilter)
Get all shapes within the axis-aligned bounding box that are part of this shape. The
filter is applied to the query and follows the same rules as the collision detection.
Declaration
public IReadOnlyList<Shape> BoundBoxQuery(BoundingBox bb, ShapeFilter filter)
Parameters
Returns
Type |
Description |
IReadOnlyList<><Shape> |
|
View Source
Contains(Body)
Test if a rigid body has been added to the space.
Declaration
public bool Contains(Body body)
Parameters
Type |
Name |
Description |
Body |
body |
|
Returns
View Source
Contains(Constraint)
Test if a constraint has been added to the space.
Declaration
public bool Contains(Constraint constraint)
Parameters
Returns
View Source
Contains(Shape)
Test if a collision shape has been added to the space.
Declaration
public bool Contains(Shape shape)
Parameters
Type |
Name |
Description |
Shape |
shape |
|
Returns
View Source
DebugDraw(IDebugDraw, DebugDrawFlags, DebugDrawColors)
Draw all objects in the space for debugging purposes using flags and colors.
Declaration
public void DebugDraw(IDebugDraw debugDraw, DebugDrawFlags flags, DebugDrawColors colors)
Parameters
View Source
DebugDraw(IDebugDraw, DebugDrawFlags)
Draw all objects in the space for debugging purposes using flags.
Declaration
public void DebugDraw(IDebugDraw debugDraw, DebugDrawFlags flags)
Parameters
View Source
DebugDraw(IDebugDraw)
Draw all objects in the space for debugging purposes.
Declaration
public void DebugDraw(IDebugDraw debugDraw)
Parameters
View Source
GetOrCreateCollisionHandler(int, int)
Create or return the existing collision handler for the specified pair of collision
types. If wildcard handlers are used with either of the collision types, it's the
responsibility of the custom handler to invoke the wildcard handlers.
Declaration
public CollisionHandler GetOrCreateCollisionHandler(int typeA, int typeB)
Parameters
Type |
Name |
Description |
int |
typeA |
|
int |
typeB |
|
Returns
View Source
GetOrCreateDefaultCollisionHandler()
Create or return the existing collision handler that is called for all collisions that are
not handled by a more specific collision handler.
Declaration
public CollisionHandler GetOrCreateDefaultCollisionHandler()
Returns
View Source
GetOrCreateWildcardHandler(int)
Create or return the existing wildcard collision handler for the specified type.
Declaration
public CollisionHandler GetOrCreateWildcardHandler(int type)
Parameters
Type |
Name |
Description |
int |
type |
|
Returns
View Source
PointQuery(Vect, double, ShapeFilter)
Get the shapes within a radius of the point location that are part of this space. The
filter is applied to the query and follows the same rules as the collision detection.
If a maxDistance of 0.0 is used, the point must lie inside a shape. Negative
maxDistance
is also allowed meaning that the point must be a under a
certain depth within a shape to be considered a match.
Declaration
public IReadOnlyList<PointQueryInfo> PointQuery(Vect point, double maxDistance, ShapeFilter filter)
Parameters
Type |
Name |
Description |
Vect |
point |
Where to check for shapes in the space.
|
double |
maxDistance |
Match only within this distance.
|
ShapeFilter |
filter |
Only pick shapes matching the filter.
|
Returns
View Source
PointQueryNearest(Vect, double, ShapeFilter)
Get the nearest shape within a radius of a point that is part of this space. The filter
is applied to the query and follows the same rules as the collision detection. If a
maxDistance
of 0.0 is used, the point must lie inside a shape.
Negative maxDistance
is also allowed, meaning that the point must be
under a certain depth within a shape to be considered a match.
Declaration
public PointQueryInfo PointQueryNearest(Vect point, double maxDistance, ShapeFilter filter)
Parameters
Type |
Name |
Description |
Vect |
point |
Where to check for collision in the space.
|
double |
maxDistance |
Match only within this distance.
|
ShapeFilter |
filter |
Only pick shapes matching the filter.
|
Returns
View Source
ReindexShape(Shape)
Update the collision detection data for a specific shape in the space.
Declaration
public void ReindexShape(Shape shape)
Parameters
Type |
Name |
Description |
Shape |
shape |
|
View Source
ReindexShapesForBody(Body)
Update the collision detection data for all shapes attached to a body.
Declaration
public void ReindexShapesForBody(Body body)
Parameters
Type |
Name |
Description |
Body |
body |
|
View Source
ReindexStatic()
Update the collision detection info for the static shapes in the space.
Declaration
public void ReindexStatic()
View Source
RemoveBody(Body)
Remove a rigid body from the simulation.
Declaration
public void RemoveBody(Body body)
Parameters
Type |
Name |
Description |
Body |
body |
|
View Source
RemoveConstraint(Constraint)
Remove a constraint from the simulation.
Declaration
public void RemoveConstraint(Constraint constraint)
Parameters
View Source
RemoveShape(Shape)
Remove a collision shape from the simulation.
Declaration
public void RemoveShape(Shape shape)
Parameters
Type |
Name |
Description |
Shape |
shape |
|
View Source
SegmentQuery(Vect, Vect, double, ShapeFilter)
Get the shapes within a capsule-shaped radius of a line segment that is part of this
space. The filter is applied to the query and follows the same rules as the collision
detection.
Declaration
public IReadOnlyList<SegmentQueryInfo> SegmentQuery(Vect start, Vect end, double radius, ShapeFilter filter)
Parameters
Returns
View Source
SegmentQueryFirst(Vect, Vect, double, ShapeFilter)
Get the first shape within a capsule-shaped radius of a line segment that is part of
this space. The filter is applied to the query and follows the same rules as the
collision detection.
Declaration
public SegmentQueryInfo SegmentQueryFirst(Vect start, Vect end, double radius, ShapeFilter filter)
Parameters
Returns
View Source
ShapeQuery(Shape)
Get all shapes in the space that are overlapping the given shape.
Declaration
public IReadOnlyList<ContactPointSet> ShapeQuery(Shape shape)
Parameters
Type |
Name |
Description |
Shape |
shape |
|
Returns
View Source
Step(double)
Update the space for the given time step. Using a fixed time step is highly recommended.
Doing so will increase the efficiency of the contact persistence, requiring an order of
magnitude fewer iterations to resolve the collisions in the usual case. It is not the
same to call step 10 times with a dt of 0.1, or 100 times with a dt of 0.01 even if the
end result is that the simulation moved forward 100 units. Performing multiple calls
with a smaller dt creates a more stable and accurate simulation. Therefore, it sometimes
makes sense to have a little for loop around the step call.
Declaration
public virtual void Step(double dt)
Parameters
Type |
Name |
Description |
double |
dt |
|
View Source
UseSpatialHash(double, int)
Switch the space to use a spatial hash as its spatial index.
Declaration
public void UseSpatialHash(double dim, int count)
Parameters
Type |
Name |
Description |
double |
dim |
|
int |
count |
|
Extension Methods