Core API Reference: World Physics

From Color Infection Wiki

Jump to: navigation, search


Contents


Set Gravity Acceleration (By Radians)

Set the world gravity acceleration by a magnitude and angle. The unit of the angle is radians.

Input Parameters:

Magnitude
the magnitude
Angle Radians
the angle (radians)

Output Parameters:

(none)
Set Gravity Acceleration (By Degrees)

Set the world gravity acceleration by a magnitude and angle. The unit of the angle is degrees.

Input Parameters:

Magnitude
the magnitude
Angle Degrees
the angle (degrees)

Output Parameters:

(none)
Set Gravity Acceleration (By Vector)

Set the world gravity acceleration by a vector.

Input Parameters:

gX
the x component of the gravity acceleration
gY
the x component of the gravity acceleration

Output Parameters:

(none)
Get Gravity Acceleration By Vector

Get all physics shapes at the specified point. The gravity contributed by gravity controllers are not counted in the return result.

Input Parameters:

(none)

Output Parameters:

gX
the x component of the gravity acceleration
gY
the y component of the gravity acceleration
Update Shape Contacts Infos

The Get Contacted Shapes API will return a step cached result. If you update the geometry of a shape, you can call this API to update the cached result.

Input Parameters:

(none)

Output Parameters:

(none)
Get Physics Shapes At Point

Get all physics shapes at the specified point.

Input Parameters:

Point X
position x
Point Y
position y

Output Parameters:

Physics Shapes
an array contains all physics shapes at the specified point. The length of the array is the number of the shapes.


Get First Incoming Intersection With Line Segment

Get the first incoming intersection with a line segment.

Input Parameters:

Start Point X
start point x of the line segment
Start Point Y
start point y of the line segment
End Point X
end point x of the line segment
End Point Y
end point y of the line segment

Output Parameters:

First Incoming Intersection
an array contains the intersection information.
- [0] is the intersected shape entity.
- [1] and [2] are the position of the intersection point, which is a point on the the intersection edge.
- [3] and [4] are the normal of the intersection edge on the shape entity.
- [5] is the fraction of the intersection point. Its value range is from 0.0 to 1.0. (The Intersection Point) = (Start Point) * (1 - fraction) + (End Point) * fraction.
- [6] is the distance between the start point and the intersection point. Its value is (the length of the line segment) x fraction.

Incoming outcoming intersections.png

Get First Outcoming Intersection With Line Segment

Get the first outcoming intersection with a line segment.

Input Parameters:

Start Point X
start point x of the line segment
Start Point Y
start point y of the line segment
End Point X
end point x of the line segment
End Point Y
end point y of the line segment

Output Parameters:

First Outcoming Intersection
an array contains the intersection information.
- [0] is the intersected shape entity.
- [1] and [2] are the position of the intersection point, which is a point on the the intersection edge.
- [3] and [4] are the normal of the intersection edge on the shape entity.
- [5] is the fraction of the intersection point. Its value range is from 0.0 to 1.0. (The Intersection Point) = (Start Point) * (1 - fraction) + (End Point) * fraction.
- [6] is the distance between the start point and the intersection point. Its value is (the length of the line segment) x fraction.
Get Intersected Shapes With Line Segment

Get all physics shapes intersected with a line segment.

Input Parameters:

Start Point X
start point x of the line segment
Start Point Y
start point y of the line segment
End Point X
end point x of the line segment
End Point Y
end point y of the line segment
Including Half Intersected Shapes?
whether return half intersected shapes or not. (See the image above to get what are half intersected shapes)

Output Parameters:

Intersected Shapes
an array contains the physics shapes intersected with the specified line segment.
Personal tools