import soy
import soy.joints
sce = soy.Scene()
cam = soy.bodies.Camera(sce)
cam.position = (0,0,10)
py1 = soy.bodies.Pyramid(sce)
py1.position = (-2,0,0)
py1.rotation = (0,2,0)
py2 = soy.bodies.Pyramid(sce)
py2.position = (2,0,0)
py2.rotation = (0,0,3)
scr = soy.Screen()
win = soy.Window(scr)
pro = soy.widgets.Projector(win, size=(320,240), camera=cam)
You'll should see two pyramids next to each other rotating on different axis. Now for the fun part:
jnt = soy.joints.Joint(sce, py1, py2)
Presto - they're locked together as if they were one larger object, their rotational velocities blended. You can watch their .rotation change. Now for the really fun part:
jnt = None
The invisible bond that connected them is nullified, and as such, they spin off in opposite directions with their own rotations.
This is only the beginning of course; there's 7 other joint types to be added!
No comments:
Post a Comment