def setupObjects(): global bodies, stencilMat x = RigidBody(3.0, (3.0,size1[1]/2.0), shape=size1) x.grounded = True ypos = [ x.pos[0] + x.shape[0]/2.0 + size2[0]*math.cos(radians(initAngle))/2.0, x.pos[1] + x.shape[1]/2.0 + size2[0]*math.sin(radians(initAngle))/2.0] y = RigidBody(1.0, ypos, theta=initAngle, shape=size2) bodies = [x, y] stencilMat[7, 2] = -y.I print stencilMat
def setupObjects(): global bodies, stencilMat x = RigidBody(mass1, initialPosition1, shape=size1) x.grounded = True y = RigidBody(mass2, initialPosition2, theta=initAngle, shape=size2) y.grounded = True bodies = [x, y] stencilMat[3,0] = y.mass stencilMat[4,1] = y.mass stencilMat[5,2] = y.I print stencilMat
def setupObjects(): global bodies x = RigidBody(1, (50, 70)) x.addForce([0, -20],[5,5]) x.addForce([0, 10],[-5, -5]) x.grounded = True y = RigidBody(1, (20, 80)) y.addForce([3, -10],[0,0]) bodies = [x, y]
def setupObjects(): global arb, gravity x = RigidBody(mass1, initialPosition1, shape=size1) x.grounded = True y = RigidBody(mass2, initialPosition2, theta=initAngle, shape=size2) y.grounded = True arb = ArticulatedBody() arb.addBody(x) arb.addBody(y) arb.add2BodyConstraint((0, r2, 1, r3)) arb.add1BodyConstraint((0, r1)) g1 = tuple(x.mass*comp for comp in gravity) g2 = tuple(y.mass*comp for comp in gravity) arb.addExternalForce(0, (g1, (0,0))) arb.addExternalForce(1, (g2, (0,0))) arb.finalize() print arb.matrix print arb.externalForces