CP::Shape::Segment
Inherits CP::Shape / Reference / Object
A line segment shape between two points.
Meant mainly as a static shape. Can be beveled in order to give them a thickness.
Constructors
The parameters are: the body to attach the segment to; the endpoints (a, b) to attach the segment to; the radius of the half-circles at the ends of the segment (thickness is twice the radius).
Class methods
Calculate the area of a fattened (capsule shaped) line segment.
Calculate the moment of inertia for a line segment.
Beveling radius is not supported.
Instance methods
Unsafe. Set the radius of a segment shape.
This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!
Unsafe. Set the endpoints of a segment shape.
This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!
Let Chipmunk know about the geometry of adjacent segments to avoid colliding with endcaps.
When you have a number of segment shapes that are all joined together, things can still collide with the "cracks" between the segments. By setting the neighbor segment endpoints you can tell Chipmunk to avoid colliding with the inner parts of the crack.