|
Physics.Hipmunk.Constraint | Portability | portable (needs FFI) | Stability | provisional | Maintainer | felipe.lessa@gmail.com |
|
|
|
|
|
Description |
Constraints that restrict the bodies' movement.
|
|
Synopsis |
|
|
|
|
Common interface
|
|
|
newConstraint b1 b2 type_ connects the two bodies b1 and b2
with a constraint of the given type. Note that you should
add the Constraint to a space.
The ConstraintType type class is implemented by all
constraint types to allow them to be manipulated by the same
framework while retaining type-safety, consequently it isn't
exported.
|
|
|
redefine constr type_ redefines constr's parameters
on-the-fly, allowing you to dynamically change the
constraint's behaviour.
|
|
|
Sets the constraint's bias coefficient. By default it is
equal to the last value set globally with
setConstraintBiasCoef, which initially is 0.1
|
|
|
Represents a constraint between two bodies. Don't forget to
add the bodies and the constraint itself to the space.
The phantom type indicates the type of the constraint.
| Instances | |
|
|
Forgetting the phantom type
|
|
These functions discard the phantom type of the constraint.
They're useful, for example, if you want to put different
constraints in a homogeneous data structure (such as a
list).
|
|
|
An unknown constraint "type". Note that this isn't a
ConstraintType because you can't create a constraint of
Unknown type.
|
|
|
|
Completely safe function that discards the constraint type
(which is a phantom type). You can "remember" it again by
using unsafeRemember from the Unsafe module.
|
|
Constraint types
|
|
There are currently nine types of constraints. When
appending a number to a property, we hint that it refer to
one of the bodies that the constraint is intercting with
(e.g. "Second anchor" is the position of the anchor on the
second body in its coordinates).
|
|
Pin joint
|
|
|
A pin joint connects the bodies with a solid pin.
The anchor points are kept at a fixed distance.
| Constructors | | Instances | |
|
|
Slide joint
|
|
|
A slide joint is similar to a pin joint, however
it has a minimum and a maximum distance.
| Constructors | Slide | | slideAnchor1 :: !Position | First anchor.
| slideAnchor2 :: !Position | Second anchor.
| slideMinDist :: !Distance | Minimum distance.
| slideMaxDist :: !Distance | Maximum distance.
|
|
| Instances | |
|
|
Pivot joint
|
|
|
A pivot joint allows the bodies to pivot around
a single point.
| Constructors | Pivot1 | You may specify the pivot point in world's coordinates
(so both bodies should be already in place).
| pivotPos :: !Position | Pivot point in world's coordinates.
|
| Pivot2 | Or you may specify the joint as two anchors (on each
body's coordinates), removing the need having the bodies
already in place.
| |
| Instances | |
|
|
Groove joint
|
|
|
A groove joint attaches a point on the second body
to a groove in the first one.
| Constructors | Groove | | groovePoints :: !(Position, Position) | Groove, in first body's coordinates.
| groovePivot :: !Position | Pivot, in second body's coordinates.
|
|
| Instances | |
|
|
Gear joint
|
|
|
A gear joint restricts the bodies movement to be
coordinated as if they were attached like dented gears.
| Constructors | Gear | | gearPhase :: !Angle | Phase of the movement.
| gearRatio :: !CpFloat | Ratio between the gears.
|
|
| Instances | |
|
|
Damped spring
|
|
|
A simple damped spring. Generally this constraint
should be used instead of applyDampedSpring.
| Constructors | DampedSpring | | dampedAnchor1 :: !Position | First anchor.
| dampedAnchor2 :: !Position | Second anchor.
| dampedRestLength :: !Distance | Rest length.
| dampedStiffness :: !CpFloat | Stiffness.
| dampedDamping :: !Damping | Damping.
|
|
| Instances | |
|
|
Damped rotary spring
|
|
data DampedRotarySpring | Source |
|
A damped rotary spring constraint.
| Constructors | DampedRotarySpring | | dampedRotRestAngle :: !Angle | Rest angle.
| dampedRotStiffness :: !CpFloat | Stiffness.
| dampedRotDamping :: !Damping | Damping.
|
|
| Instances | |
|
|
Rotary limit
|
|
|
A rotary limit constraints the difference of angle
between two bodies.
| Constructors | RotaryLimit | | rotaryMinDist :: Distance | Minimum distance.
| rotaryMaxDist :: Distance | Maximum distance.
|
|
| Instances | |
|
|
Simple motor
|
|
|
A simple motor that applies opposite impulses to each
body. The rate is used to compute the torque.
| Constructors | | Instances | |
|
|
Produced by Haddock version 2.4.2 |