Set Connector

Damping

Sets the damping coefficent (C for springs and Ctor for torsional springs). Applicable to springs and torsional springs.

Automatically generated code (generated by the behavior dialog):

# Set spring1's damping when mouse enters into rectangle1.
rectangle1.bind(ENTER, system.evtHandler, SETDAMPING,
                **{'target': spring1, 'C': .2})

Manually created code (equivalent to the automatically generated code shown above):

def setDamping(event, source, target, C):
    target.C = C

rectangle1.bind(ENTER, setDamping, target=spring1, C=.2)

Stiffness

Sets the stiffness value (K for springs and Ktor for torsional springs). Applicable to springs and torsional springs.

Automatically generated code (generated by the behavior dialog):

# Set spring1's stiffness when rectangle1 collides with ANYBODY.
rectangle1.bind(COLLISION, system.evtHandler, ANYBODY, SETSTIFFNESS,
                **{'target': spring1, 'K': 25})

Manually created code (equivalent to the automatically generated code shown above):

def setStiffness(event, source, target, K):
    target.K = K

rectangle1.bind(COLLISION, setStiffness, other=ANYBODY, K=25)

Initial angle

Sets a torsional spring’s initial angle (A0). Applicable to torsional springs only.

Automatically generated code (generated by the behavior dialog):

# Set torSpring1's initial when SPACE key is pressed down.
rectangle2.bind(KEYDOWN, system.evtHandler, key.SPACE, SETINITANGLE,
                **{'target': torSpring1, 'A0': pi/2})

Manually created code (equivalent to the automatically generated code shown above):

def setInitAngle(event, source, target, angle):
    target.A0 = angle

rectangle2.bind(KEYDOWN, setInitAngle, keyCode=key.SPACE, target=torSpring1, angle=pi/2)

Initial length

Sets a spring’s initial length (L0). Applicable to springs only.

Automatically generated code (generated by the behavior dialog):

# Set spring1's initial length when rectangle1 collides with ANYRECTANGLE.
rectangle1.bind(COLLISION, system.evtHandler, ANYRECTANGLE, SETINITLENGTH,
                **{'target': spring1, 'L0': 0})

Manually created code (equivalent to the automatically generated code shown above):

def setInitLength(event, source, target, length):
    target.L0 = length

rectangle1.bind(COLLISION, setInitLength, other=ANYRECTANGLE, target=spring1, length=0)

Motor speed

Adjust a motor’s or pin joint’s motor speed. Applicable to motors and pin joints.

Note

Pin joints can be motorized by setting their enableMotor attribute to True and rpm attribute to a non-zero value.

Automatically generated code (generated by the behavior dialog):

# Set motor1's revolutions per minute when RIGHT_ARROW key is pressed down.
circle1.bind(KEYDOWN, system.evtHandler, key.RIGHT_ARROW, SETRPM,
             **{'target': motor1, 'rpm': 60})

Manually created code (equivalent to the automatically generated code shown above):

def setRPM(event, source, target, rpm):
    target.rpm = rpm

circle1.bind(KEYDOWN, setRPM, keyCode=key.RIGHT_ARROW, target=motor1, rpm=60)

Lower limit

Sets the lower angle limit. Applicable to motors, torsional springs, and pin joints.

Automatically generated code (generated by the behavior dialog):

# Set pin1's lower angle limit when left mouse button is pressed down.
rectangle3.bind(LEFTDOWN, system.evtHandler, SETLOWERANGLE,
                **{'target': pin1, 'lowerAngle': 0, 'enableLimit': True})

Manually created code (equivalent to the automatically generated code shown above):

def setLowerLimit(event, source, target, angle):
    target.enableLimit = True
    target.lowerAngle = angle

rectangle3.bind(LEFTDOWN, setLowerLimit, target=pin1, angle=0)

Upper limit

Sets the upper angle limit. Applicable to motors, torsional springs, and pin joints.

Automatically generated code (generated by the behavior dialog):

# Set pin1's upper angle limit when left mouse button is pressed down.
rectangle3.bind(LEFTDOWN, system.evtHandler, SETUPPERANGLE,
                **{'target': pin1, 'upperAngle': 3.14, 'enableLimit': True})

Manually created code (equivalent to the automatically generated code shown above):

def setUpperLimit(event, source, target, angle):
    target.enableLimit = True
    target.upperAngle = angle

rectangle3.bind(LEFTDOWN, setUpperLimit, target=pin1, angle=3.14)

Body1 X-Y

Sets b1x and/or b1y.

Automatically generated code (generated by the behavior dialog):

# Set chain1's body1X when left mouse button is pressed down.
polygon1.bind(LEFTDOWN, system.evtHandler, SETBODY1XY,
              **{'target': chain1, 'b1x': 5, 'b1y': 12})

Manually created code (equivalent to the automatically generated code shown above):

def setBodyXY(event, source, target, b1x, b1y):
    target.b1x = b1x
    target.b1y = b1y

polygon1.bind(LEFTDOWN, setBodyXY, target=chain1, b1x=5, b1y=12)

Body2 X-Y

Sets b2x and/or b2y.

Automatically generated code (generated by the behavior dialog):

# Set chain1's body1X when left mouse button is pressed down.
polygon1.bind(LEFTDOWN, system.evtHandler, SETBODY2XY,
              **{'target': chain1, 'b2x': 5, 'b2y': 12})

Manually created code (equivalent to the automatically generated code shown above):

def setBodyXY(event, source, target, b2x, b2y):
    target.b2x = b2x
    target.b2y = b2y

polygon1.bind(LEFTDOWN, setBodyXY, target=chain1, b2x=5, b2y=12)

Break Force

Sets the break force. Applicable to all connector types but welds, beams, and belts.

Automatically generated code (generated by the behavior dialog):

# Set chain1's break force when polygon1 collides with ANYWALL.
polygon1.bind(COLLISION, system.evtHandler, ANYWALL, SETBREAKFORCE,
              **{'target': chain1, 'breakForce': 25})

Manually created code (equivalent to the automatically generated code shown above):

def setBreakForce(event, source, target, breakForce):
    target.breakForce = breakForce

polygon1.bind(COLLISION, setBreakForce, other=ANYWALL, target=chain1, breakForce=25)

Break Torque

Sets the break torque. Applicable to motors and torsional springs.

Automatically generated code (generated by the behavior dialog):

# Set torSpring1's break when B key is pressed down.
rectangle1.bind(KEYDOWN, system.evtHandler, key.B, SETBREAKTORQUE,
                **{'target': torSpring1, 'breakTorque': 20})

Manually created code (equivalent to the automatically generated code shown above):

def setBreakTorque(event, source, target, breakTorque):
    target.breakTorque = breakForce

rectangle1.bind(KEYDOWN, setBreakTorque, keyCode=key.B, target=torSpring1, breakTorque=20)

Table Of Contents

Previous topic

Adjust Connector

Next topic

Adjust Rigid Body

This Page