Portability  portable (needs FFI) 

Stability  provisional 
Maintainer  felipe.lessa@gmail.com 
Constraints that restrict the bodies' movement.
 newConstraint :: ConstraintType a => Body > Body > a > IO (Constraint a)
 redefineC :: ConstraintType a => Constraint a > a > IO ()
 setBiasCoefC :: BiasCoef > Constraint a > IO ()
 data Constraint a
 data Unknown
 forgetC :: Constraint a > Constraint Unknown
 data Pin = Pin {
 pinAnchor1 :: !Position
 pinAnchor2 :: !Position
 data Slide = Slide {
 slideAnchor1 :: !Position
 slideAnchor2 :: !Position
 slideMinDist :: !Distance
 slideMaxDist :: !Distance
 data Pivot
 = Pivot1 { }
  Pivot2 {
 pivotAnchor1 :: !Position
 pivotAnchor2 :: !Position
 data Groove = Groove {
 groovePoints :: !(Position, Position)
 groovePivot :: !Position
 data Gear = Gear {}
 data DampedSpring = DampedSpring {}
 data DampedRotarySpring = DampedRotarySpring {}
 data RotaryLimit = RotaryLimit {}
 data SimpleMotor = SimpleMotor {}
Common interface
newConstraint :: ConstraintType a => Body > Body > a > IO (Constraint a)Source
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 typesafety, consequently it isn't
exported.
redefineC :: ConstraintType a => Constraint a > a > IO ()Source
redefine constr type_
redefines constr
's parameters
onthefly, allowing you to dynamically change the
constraint's behaviour.
setBiasCoefC :: BiasCoef > Constraint a > IO ()Source
Sets the constraint's bias coefficient. By default it is
equal to the last value set globally with
setConstraintBiasCoef
, which initially is 0.1
data Constraint a Source
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.
Eq (Constraint a)  
Ord (Constraint a)  
Entity (Constraint a) 
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.
forgetC :: Constraint a > Constraint UnknownSource
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.
Pin  

Slide joint
A slide joint is similar to a pin joint, however it has a minimum and a maximum distance.
Slide  

Pivot joint
A pivot joint allows the bodies to pivot around a single point.
Pivot1  You may specify the pivot point in world's coordinates (so both bodies should be already in place). 
Pivot2  Or you may specify the joint as two anchors (on each body's coordinates), removing the need having the bodies already in place. 

Groove joint
A groove joint attaches a point on the second body to a groove in the first one.
Groove  

Gear joint
A gear joint restricts the bodies movement to be coordinated as if they were attached like dented gears.
Damped spring
data DampedSpring Source
A simple damped spring. Generally this constraint
should be used instead of applyDampedSpring
.
DampedSpring  

Eq DampedSpring  
Ord DampedSpring  
Show DampedSpring  
ConstraintType DampedSpring 
Damped rotary spring
data DampedRotarySpring Source
A damped rotary spring constraint.
DampedRotarySpring  

Eq DampedRotarySpring  
Ord DampedRotarySpring  
Show DampedRotarySpring  
ConstraintType DampedRotarySpring 
Rotary limit
data RotaryLimit Source
A rotary limit constraints the difference of angle between two bodies.
RotaryLimit  

Eq RotaryLimit  
Ord RotaryLimit  
Show RotaryLimit  
ConstraintType RotaryLimit 
Simple motor
data SimpleMotor Source
A simple motor that applies opposite impulses to each body. The rate is used to compute the torque.
SimpleMotor  

Eq SimpleMotor  
Ord SimpleMotor  
Show SimpleMotor  
ConstraintType SimpleMotor 