# `pymunk.constraints` Module

A constraint is something that describes how two bodies interact with each other. (how they constrain each other). Constraints can be simple joints that allow bodies to pivot around each other like the bones in your body, or they can be more abstract like the gear joint or motors.

This submodule contain all the constraints that are supported by Pymunk.

All the constraints support copy and pickle from the standard library. Custom properties set on a constraint will also be copied/pickled.

Chipmunk has a good overview of the different constraint on youtube which works fine to showcase them in Pymunk as well. http://www.youtube.com/watch?v=ZgJJZTS0aMM

Example:

    >>> import pymunk
    >>> import pymunk.constraints
    >>> s = pymunk.Space()
    >>> a,b = pymunk.Body(10,10), pymunk.Body(10,10)
    >>> c = pymunk.constraints.PivotJoint(a, b, (0,0))
    >>> s.add(c)

class `pymunk.constraints.``Constraint`(constraint: _cffi_backend._CDataBase)

  Bases: `pymunk._pickle.PickleMixin`, `pymunk._typing_attr.TypingAttrMixing`, `object`

  Base class of all constraints.

  You usually don’t want to create instances of this class directly, but instead use one of the specific constraints such as the PinJoint.

  `__init__`(constraint: _cffi_backend._CDataBase) → None

    Initialize self. See help(type(self)) for accurate signature.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

class `pymunk.constraints.``DampedRotarySpring`(a: Body, b: Body, rest_angle: float, stiffness: float, damping: float)

  Bases: `pymunk.constraints.Constraint`

  DampedRotarySpring works like the DammpedSpring but in a angular fashion.

  `__init__`(a: Body, b: Body, rest_angle: float, stiffness: float, damping: float) → None

    Like a damped spring, but works in an angular fashion.

    Parameters

      - a (Body) – Body a

      - b (Body) – Body b

      - rest_angle (float) – The relative angle in radians that the bodies want to have

      - stiffness (float) – The spring constant (Young’s modulus).

      - damping (float) – How soft to make the damping of the spring.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `damping`

    How soft to make the damping of the spring.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

  property `rest_angle`

    The relative angle in radians that the bodies want to have

  property `stiffness`

    The spring constant (Young’s modulus).

class `pymunk.constraints.``DampedSpring`(a: Body, b: Body, anchor_a: Tuple[float, float], anchor_b: Tuple[float, float], rest_length: float, stiffness: float, damping: float)

  Bases: `pymunk.constraints.Constraint`

  DampedSpring is a damped spring.

  The spring allows you to define the rest length, stiffness and damping.

  `__init__`(a: Body, b: Body, anchor_a: Tuple[float, float], anchor_b: Tuple[float, float], rest_length: float, stiffness: float, damping: float) → None

    Defined much like a slide joint.

    Parameters

      - a (Body) – Body a

      - b (Body) – Body b

      - anchor_a ((float,float)) – Anchor point a, relative to body a

      - anchor_b ((float,float)) – Anchor point b, relative to body b

      - rest_length (float) – The distance the spring wants to be.

      - stiffness (float) – The spring constant (Young’s modulus).

      - damping (float) – How soft to make the damping of the spring.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `anchor_a`
  property `anchor_b`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `damping`

    How soft to make the damping of the spring.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

  property `rest_length`

    The distance the spring wants to be.

  property `stiffness`

    The spring constant (Young’s modulus).

class `pymunk.constraints.``GearJoint`(a: Body, b: Body, phase: float, ratio: float)

  Bases: `pymunk.constraints.Constraint`

  GearJoint keeps the angular velocity ratio of a pair of bodies constant.

  `__init__`(a: Body, b: Body, phase: float, ratio: float)

    Keeps the angular velocity ratio of a pair of bodies constant.

    ratio is always measured in absolute terms. It is currently not possible to set the ratio in relation to a third body’s angular velocity. phase is the initial angular offset of the two bodies.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `phase`
  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

  property `ratio`

class `pymunk.constraints.``GrooveJoint`(a: Body, b: Body, groove_a: Tuple[float, float], groove_b: Tuple[float, float], anchor_b: Tuple[float, float])

  Bases: `pymunk.constraints.Constraint`

  GrooveJoint is similar to a PivotJoint, but with a linear slide.

  One of the anchor points is a line segment that the pivot can slide in instead of being fixed.

  `__init__`(a: Body, b: Body, groove_a: Tuple[float, float], groove_b: Tuple[float, float], anchor_b: Tuple[float, float]) → None

    The groove goes from groove_a to groove_b on body a, and the pivot is attached to anchor_b on body b.

    All coordinates are body local.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `anchor_b`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `groove_a`
  property `groove_b`
  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

class `pymunk.constraints.``PinJoint`(a: Body, b: Body, anchor_a: Tuple[float, float] = (0, 0), anchor_b: Tuple[float, float] = (0, 0))

  Bases: `pymunk.constraints.Constraint`

  PinJoint links shapes with a solid bar or pin.

  Keeps the anchor points at a set distance from one another.

  `__init__`(a: Body, b: Body, anchor_a: Tuple[float, float] = (0, 0), anchor_b: Tuple[float, float] = (0, 0)) → None

    a and b are the two bodies to connect, and anchor_a and anchor_b are the anchor points on those bodies.

    The distance between the two anchor points is measured when the joint is created. If you want to set a specific distance, use the setter function to override it.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `anchor_a`
  property `anchor_b`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `distance`
  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

class `pymunk.constraints.``PivotJoint`(a: Body, b: Body, *args: Union[Tuple[float, float], Tuple[Tuple[float, float], Tuple[float, float]]])

  Bases: `pymunk.constraints.Constraint`

  PivotJoint allow two objects to pivot about a single point.

  Its like a swivel.

  `__init__`(a: Body, b: Body, *args: Union[Tuple[float, float], Tuple[Tuple[float, float], Tuple[float, float]]]) → None

    a and b are the two bodies to connect, and pivot is the point in world coordinates of the pivot.

    Because the pivot location is given in world coordinates, you must have the bodies moved into the correct positions already. Alternatively you can specify the joint based on a pair of anchor points, but make sure you have the bodies in the right place as the joint will fix itself as soon as you start simulating the space.

    That is, either create the joint with PivotJoint(a, b, pivot) or PivotJoint(a, b, anchor_a, anchor_b).

    Parameters

      - a (Body) – The first of the two bodies

      - b (Body) – The second of the two bodies

      - args ((float,float) or (float,float) (float,float)) – Either one pivot point, or two anchor points

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `anchor_a`
  property `anchor_b`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

class `pymunk.constraints.``RatchetJoint`(a: Body, b: Body, phase: float, ratchet: float)

  Bases: `pymunk.constraints.Constraint`

  RatchetJoint is a rotary ratchet, it works like a socket wrench.

  `__init__`(a: Body, b: Body, phase: float, ratchet: float) → None

    Works like a socket wrench.

    ratchet is the distance between “clicks”, phase is the initial offset to use when deciding where the ratchet angles are.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `angle`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `phase`
  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

  property `ratchet`

class `pymunk.constraints.``RotaryLimitJoint`(a: Body, b: Body, min: float, max: float)

  Bases: `pymunk.constraints.Constraint`

  RotaryLimitJoint constrains the relative rotations of two bodies.

  `__init__`(a: Body, b: Body, min: float, max: float) → None

    Constrains the relative rotations of two bodies.

    min and max are the angular limits in radians. It is implemented so that it’s possible to for the range to be greater than a full revolution.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max`
  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `min`
  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

class `pymunk.constraints.``SimpleMotor`(a: Body, b: Body, rate: float)

  Bases: `pymunk.constraints.Constraint`

  SimpleMotor keeps the relative angular velocity constant.

  `__init__`(a: Body, b: Body, rate: float) → None

    Keeps the relative angular velocity of a pair of bodies constant.

    rate is the desired relative angular velocity. You will usually want to set an force (torque) maximum for motors as otherwise they will be able to apply a nearly infinite torque to keep the bodies moving.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None

  property `rate`

    The desired relative angular velocity

class `pymunk.constraints.``SlideJoint`(a: Body, b: Body, anchor_a: Tuple[float, float], anchor_b: Tuple[float, float], min: float, max: float)

  Bases: `pymunk.constraints.Constraint`

  SlideJoint is like a PinJoint, but have a minimum and maximum distance.

  A chain could be modeled using this joint. It keeps the anchor points from getting to far apart, but will allow them to get closer together.

  `__init__`(a: Body, b: Body, anchor_a: Tuple[float, float], anchor_b: Tuple[float, float], min: float, max: float) → None

    a and b are the two bodies to connect, anchor_a and anchor_b are the anchor points on those bodies, and min and max define the allowed distances of the anchor points.

  property `a`

    The first of the two bodies constrained

  `activate_bodies`() → None

    Activate the bodies this constraint is attached to

  property `anchor_a`
  property `anchor_b`
  property `b`

    The second of the two bodies constrained

  property `collide_bodies`

    Constraints can be used for filtering collisions too.

    When two bodies collide, Pymunk ignores the collisions if this property is set to False on any constraint that connects the two bodies. Defaults to True. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

  `copy`() → T

    Create a deep copy of this object.

  property `error_bias`

    The percentage of joint error that remains unfixed after a second.

    This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

    Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

  property `impulse`

    The most recent impulse that constraint applied.

    To convert this to a force, divide by the timestep passed to space.step(). You can use this to implement breakable joints to check if the force they attempted to apply exceeded a certain threshold.

  property `max`
  property `max_bias`

    The maximum speed at which the constraint can apply error correction.

    Defaults to infinity

  property `max_force`

    The maximum force that the constraint can use to act on the two bodies.

    Defaults to infinity

  property `min`
  property `post_solve`

    The post-solve function is called after the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def post_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.post_solve = post_solve_func
        >>> j.post_solve = None

  property `pre_solve`

    The pre-solve function is called before the constraint solver runs.

    Note that None can be used to reset it to default value.

        >>> import pymunk
        >>> j = pymunk.PinJoint(pymunk.Body(1,2), pymunk.Body(3,4), (0,0))
        >>> def pre_solve_func(constraint, space):
        ...     print("Hello from pre-solve")
        >>> j.pre_solve = pre_solve_func
        >>> j.pre_solve = None