Skip to main content

Module shape

Module shape 

Source

Structs§

ChainShape
Internal chain shape. (b2ChainShape)
Shape
Internal shape. (b2Shape)
ShapeExtent
(b2ShapeExtent)

Functions§

chain_get_segment_count
Get the number of segments on this chain. (b2Chain_GetSegmentCount)
chain_get_segments
Get the segment shape ids for a chain, up to capacity. (b2Chain_GetSegments — returns a Vec instead of filling a caller array)
chain_get_surface_material
Get a chain surface material by segment index. (b2Chain_GetSurfaceMaterial)
chain_get_surface_material_count
Get the number of chain surface materials: 1 (shared) or the segment count. (b2Chain_GetSurfaceMaterialCount)
chain_is_valid
Chain id validity. (b2Chain_IsValid — the world-registry check collapses to the index/generation check in the registry-less port)
chain_set_surface_material
Set a chain surface material, propagating it to the affected segment shape(s). (b2Chain_SetSurfaceMaterial)
collide_mover
(b2CollideMover)
compute_shape_aabb
(b2ComputeShapeAABB)
compute_shape_extent
(b2ComputeShapeExtent)
compute_shape_mass
(b2ComputeShapeMass)
create_capsule_shape
(b2CreateCapsuleShape)
create_chain
Create a chain shape: a sequence of chain segments attached to a body. The def must have at least 4 points. (b2CreateChain)
create_chain_segment_shape
(b2CreateChainSegmentShape)
create_circle_shape
(b2CreateCircleShape)
create_polygon_shape
(b2CreatePolygonShape)
create_segment_shape
(b2CreateSegmentShape)
create_shape_proxy
(b2CreateShapeProxy)
destroy_chain
Destroy a chain shape and all its segments. (b2DestroyChain + b2FreeChainData)
destroy_shape
Destroy a shape by id, optionally updating the body mass. (b2DestroyShape)
destroy_shape_proxy
(b2DestroyShapeProxy)
get_chain_index
Validate a ChainId and return the raw chain index. (static b2GetChainShape — C returns a pointer; Rust returns the index into world.chain_shapes)
get_shape_centroid
(b2GetShapeCentroid)
get_shape_index
Validate a ShapeId and return the raw shape index. (b2GetShape — C returns a pointer; Rust returns the index into world.shapes)
get_shape_perimeter
(b2GetShapePerimeter)
get_shape_projected_perimeter
This projects the shape perimeter onto an infinite line. (b2GetShapeProjectedPerimeter)
make_shape_distance_proxy
(b2MakeShapeDistanceProxy)
ray_cast_shape
(b2RayCastShape)
shape_apply_wind
Apply wind to a shape, applying drag and lift forces to the owning body. (b2Shape_ApplyWind)
shape_are_contact_events_enabled
Returns true if contact events are enabled. (b2Shape_AreContactEventsEnabled)
shape_are_hit_events_enabled
Returns true if hit events are enabled. (b2Shape_AreHitEventsEnabled)
shape_are_pre_solve_events_enabled
Returns true if pre-solve events are enabled. (b2Shape_ArePreSolveEventsEnabled)
shape_are_sensor_events_enabled
Returns true if sensor events are enabled. (b2Shape_AreSensorEventsEnabled)
shape_cast_shape
(b2ShapeCastShape)
shape_compute_mass_data
Compute the mass data for a shape. (b2Shape_ComputeMassData)
shape_enable_contact_events
Enable contact events for this shape. (b2Shape_EnableContactEvents)
shape_enable_hit_events
Enable contact hit events for this shape. (b2Shape_EnableHitEvents)
shape_enable_pre_solve_events
Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to multithreading. (b2Shape_EnablePreSolveEvents)
shape_enable_sensor_events
Enable sensor events for this shape. (b2Shape_EnableSensorEvents)
shape_get_aabb
Get the current world AABB. This is the axis-aligned bounding box in world coordinates. (b2Shape_GetAABB)
shape_get_body
Get the id of the body that a shape is attached to. (b2Shape_GetBody)
shape_get_capsule
Get a copy of the shape’s capsule. Asserts the type is correct. (b2Shape_GetCapsule)
shape_get_chain_segment
Get a copy of the shape’s chain segment. These come from chain shapes. Asserts the type is correct. (b2Shape_GetChainSegment)
shape_get_circle
Get a copy of the shape’s circle. Asserts the type is correct. (b2Shape_GetCircle)
shape_get_closest_point
Get the closest point on a shape to a target point. Target and result are in world space. (b2Shape_GetClosestPoint)
shape_get_contact_capacity
Get the maximum capacity required for retrieving all the touching contacts on a shape. (b2Shape_GetContactCapacity)
shape_get_contact_data
Get the touching contact data for a shape. (b2Shape_GetContactData — returns a Vec instead of filling a caller array)
shape_get_density
Get the density of a shape, usually in kg/m^2. (b2Shape_GetDensity)
shape_get_filter
Get the shape filter. (b2Shape_GetFilter)
shape_get_friction
Get the friction of a shape. (b2Shape_GetFriction)
shape_get_parent_chain
Get the parent chain id if the shape type is a chain segment, otherwise returns the null chain id. (b2Shape_GetParentChain)
shape_get_polygon
Get a copy of the shape’s convex polygon. Asserts the type is correct. (b2Shape_GetPolygon)
shape_get_restitution
Get the shape restitution. (b2Shape_GetRestitution)
shape_get_segment
Get a copy of the shape’s line segment. Asserts the type is correct. (b2Shape_GetSegment)
shape_get_sensor_capacity
Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape. Returns 0 if the shape is not a sensor. (b2Shape_GetSensorCapacity)
shape_get_sensor_data
Get the overlapped shapes for a sensor shape. Overlaps may contain destroyed shapes, so use shape_is_valid to confirm each overlap. (b2Shape_GetSensorData — returns a Vec instead of filling a caller array)
shape_get_surface_material
Get the shape’s surface material. (b2Shape_GetSurfaceMaterial)
shape_get_type
Get the type of a shape. (b2Shape_GetType)
shape_get_user_data
Get the user data for a shape. (b2Shape_GetUserData)
shape_get_user_material
Get the shape’s user material identifier. (b2Shape_GetUserMaterial)
shape_is_sensor
Returns true if the shape is a sensor. (b2Shape_IsSensor)
shape_is_valid
Shape id validity. (b2Shape_IsValid — the world-registry check collapses to the index/generation check in the registry-less port)
shape_ray_cast
Ray cast a shape directly. (b2Shape_RayCast)
shape_set_capsule
Allows you to change a shape to be a capsule or update the current capsule. (b2Shape_SetCapsule)
shape_set_chain_segment
Allows you to change a shape to be a stand-alone chain segment or update the current one. Cannot be used on a segment owned by a chain shape. (b2Shape_SetChainSegment)
shape_set_circle
Allows you to change a shape to be a circle or update the current circle. (b2Shape_SetCircle)
shape_set_density
Set the mass density of a shape, usually in kg/m^2. (b2Shape_SetDensity)
shape_set_filter
Set the current filter. This is almost as expensive as recreating the shape. Sensor overlaps are not updated until the next time step. (b2Shape_SetFilter)
shape_set_friction
Set the friction on a shape. (b2Shape_SetFriction)
shape_set_polygon
Allows you to change a shape to be a polygon or update the current polygon. (b2Shape_SetPolygon)
shape_set_restitution
Set the shape restitution. (b2Shape_SetRestitution)
shape_set_segment
Allows you to change a shape to be a segment or update the current segment. (b2Shape_SetSegment)
shape_set_surface_material
Set the shape’s surface material. (b2Shape_SetSurfaceMaterial)
shape_set_user_data
Set the user data for a shape. (b2Shape_SetUserData)
shape_set_user_material
Set the shape’s user material identifier. (b2Shape_SetUserMaterial)
shape_test_point
Test a point for overlap with a shape. (b2Shape_TestPoint)
should_query_collide
(static inline b2ShouldQueryCollide)
should_shapes_collide
(static inline b2ShouldShapesCollide)