Ticket #957: joint_blocks.py

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