| 1 | #!/usr/bin/env python |
|---|
| 2 | import soy |
|---|
| 3 | import blocks |
|---|
| 4 | import sys |
|---|
| 5 | from time import sleep |
|---|
| 6 | |
|---|
| 7 | sce = soy.scenes.Scene() |
|---|
| 8 | |
|---|
| 9 | lig = soy.bodies.Light(sce) |
|---|
| 10 | lig.position = (-10.0,10.0,2.0) |
|---|
| 11 | |
|---|
| 12 | cam = soy.bodies.Camera(sce) |
|---|
| 13 | cam.position = (0.0, 0.0, 10.0) |
|---|
| 14 | |
|---|
| 15 | scr = soy.Screen() |
|---|
| 16 | win = soy.Window(scr, 'Collision Blocks', background=soy.colors.teal) |
|---|
| 17 | pro = soy.widgets.Projector(win, camera=cam) |
|---|
| 18 | |
|---|
| 19 | mat = soy.materials.Material() |
|---|
| 20 | mat.shininess = 5 |
|---|
| 21 | |
|---|
| 22 | cube1_sh = soy.shapes.Box(1, 1, 1) |
|---|
| 23 | cube2_sh = soy.shapes.Box(0.8,0.8,0.8) |
|---|
| 24 | cube1 = soy.bodies.Body(scene=sce, model=soy.models.Shape(mat), shape=cube1_sh) |
|---|
| 25 | cube1.position = (1,1,1) |
|---|
| 26 | cube1.rotation = (1,0,0) |
|---|
| 27 | |
|---|
| 28 | cube2 = soy.bodies.Body(scene=sce, model=soy.models.Shape(mat), shape=cube2_sh) |
|---|
| 29 | cube2.rotation = (0,1,0) |
|---|
| 30 | |
|---|
| 31 | # uncommenting next line causes loop to freeze |
|---|
| 32 | #jnt = soy.joints.Fixed(sce, cube1, cube2) |
|---|
| 33 | |
|---|
| 34 | if __name__ == '__main__' : |
|---|
| 35 | while True: |
|---|
| 36 | sleep(.1) |
|---|