add material option for wLabel3D
[pyworlds.git] / tests / basic-2.py
blob2658e0190ee0691dac561158ffb0b299bf077c2f
1 #!/usr/bin/python
2 import sys,os
3 sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..', 'src')))
5 import pyworlds.worlds as w
6 from pyworlds.basics.body import *
7 from soya.sdlconst import *
9 w.init()
11 sword = PhysicsBody(mesh_file="sword")
13 sword.rotation[1]=90.0
14 sword.rotation[0]=17.0
15 sword.rotation[2]=3.0
16 w.camera.set_xyz(0,0,5)
17 sword.set_timefactor(1)
19 def mainloop():
20 global sword
21 if K_UP in w.KEY: sword.rotation[0]+=10
22 if K_DOWN in w.KEY: sword.rotation[0]-=10
23 if K_LEFT in w.KEY: sword.rotation[1]+=10
24 if K_RIGHT in w.KEY: sword.rotation[1]-=10
25 if K_RSHIFT in w.KEY: sword.rotation[2]+=10
26 if K_RCTRL in w.KEY: sword.rotation[2]-=10
28 @sword.addloopcall
29 def swordloop(t):
30 if t==0: return 0;
31 sword.rotation[0]/=1+0.50*t
32 sword.rotation[1]/=1+0.50*t
33 sword.rotation[2]/=1+0.50*t
34 return t
38 w.begin_loop(callbackround=mainloop)