Singleplayer
carsingleplayer.py — text/python-source, 19 KB (20378 bytes)
Dateiinhalt
from visual import * # Szene-Einstellungen scene.userzoom = True # User darf zoomen? scene.userspin = True # User darf rotieren? scene.forward = (-1,-1,-1) # Kameraposition scene.autoscale = True # Autoskalierung aktiv? scene.range = 120 # Kameraabstand von scene.center scene.center = (0,0,0) # Kamerablickpunkt: norm. (0,0,0) scene.up = (0,1,0) # Rotationsachse Kamera: norm. (0,1,0) scene.background = color.white # Hintergrundfarbe scene.fov = 1 # Kamerawinkeloeffnung: norm. 1 scene.fullscreen = False # Vollbild? norm. False scene.title = "Auto_single" # Fenstertitel scene.width = 1000 # Fensterbreite: norm. 200 scene.height = 1000 # Fensterhoehe: norm 200 scene.x = 0 # x-Koordinate d. Fensters: norm. 0 scene.y = 0 # y-Koordinate d. Fensters: norm. 0 floor = box(pos=(0,0,0), width=1000, height=1, length=1200, color=(0.1,0.9,0.2), material=materials.rough) strecke=paths.ellipse(width=800,height=600) straight=[(0,0,0),(0,1,0)] extrusion(pos=straight, shape=strecke, color=(0.5,0.6,0.6), material=materials.rough) innen=paths.ellipse(width=600,height=400) straight=[(0,0,0),(0,1.1,0)] extrusion(pos=straight, shape=innen, color=(0.1,0.9,0.2),material=materials.rough) wand=box(pos=(600,1000,0), width=1000, height=2000, length=2, color=(0.1,0.5,1), material=materials.plastic) wand=box(pos=(0,1000,500), width=2, height=2000, length=1200, color=(0.1,0.5,1), material=materials.plastic) wand=box(pos=(-600,1000,0), width=1000, height=2000, length=2, color=(0.1,0.5,1), material=materials.plastic) wand=box(pos=(0,1000,-500), width=2, height=2000, length=1200, color=(0.1,0.5,1), material=materials.plastic) absperrung1=cone(pos=(400,2,0), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(375,2,110), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(300,2,200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(200,2,260), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(100,2,290), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(0,2,300), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-375,2,110), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-300,2,200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-200,2,260), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-100,2,290), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-400,2,0), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(375,2,-110), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(300,2,-200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(200,2,-260), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(100,2,-290), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(0,2,-300), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-375,2,-110), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-300,2,-200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-200,2,-260), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-100,2,-290), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(300,2,0), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(270,2,85), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(200,2,145), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(100,2,185), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(0,2,200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-300,2,0), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-270,2,85), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-200,2,145), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-100,2,185), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(0,2,-200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(270,2,-85), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(200,2,-145), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(100,2,-185), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(0,2,-200), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-270,2,-85), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-200,2,-145), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) absperrung1=cone(pos=(-100,2,-185), axis=(0,5,0), radius=2.5, color=(1,0.5,0)) start=box(pos=(350,1.1,0), length=100, height=0.1, width=10, color=(1.5,1.5,1.5)) saeule=cylinder(pos=(300,1,0),axis=(0,100,0), radius=1) saeule=cylinder(pos=(400,1,0),axis=(0,100,0), radius=1) fahne = box(pos=(350,85,0), length=100, height=20, width=0.1, color=(1.5,1.5,1.5)) karo= box(pos=(302.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(312.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(322.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(332.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(342.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(352.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(362.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(372.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(382.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(392.5,77.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(307.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(317.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(327.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(337.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(347.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(357.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(367.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(377.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(387.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(397.5,82.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(302.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(312.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(322.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(332.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(342.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(352.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(362.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(372.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(382.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(392.5,87.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(307.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(317.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(327.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(337.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(347.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(357.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(367.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(377.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(387.5,92.5,0), length=5, height=5, width=0.2, color=color.black) karo= box(pos=(397.5,92.5,0), length=5, height=5, width=0.2, color=color.black) baumstamm=cylinder(pos=(450,2,-150),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(450,55,-150), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(320,2,-185),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(320,55,-185), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(200,2,-300),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(200,55,-300), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(110,2,-350),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(110,55,-350), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(430,2,-320),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(430,55,-320), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(300,2,-300),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(300,55,-300), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-360,2,-150),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-360,55,-150), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-300,2,-400),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-300,55,-400), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-200,2,-300),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-200,55,-300), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-60,2,-320),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-60,55,-320), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-10,2,-400),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-10,55,-400), radius=25, color=(0.19,0.55,0.05),material=materials.marble) baumstamm=cylinder(pos=(-150,2,-380),axis=(0,30,0), radius=3, color=(0.5,0.3,0.2),material=materials.wood) blaetter=sphere(pos=(-150,55,-380), radius=25, color=(0.19,0.55,0.05),material=materials.marble) haus=box(pos=(-390,25,-280), length=200, height=70, width=120, material=materials.wood) dach=pyramid(pos=(-390,60,-280), size=(20,210,130), axis=(0,1,0), color=(0.9,0.3,0.2), material=materials.diffuse) trib=frame(axis=(-0.5,0,0.5)) stufe = box(pos=(500,3.5,110), length=150, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(510,13.5,110), length=130, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(520,23.5,110), length=110, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(530,33.5,110), length=90, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(540,43.5,110), length=70, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(550,53.5,110), length=50, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) dach = box(pos=(500,135,110), length=150, height=1, width=300, frame=trib, axis=(1,-0.2, 0), color=(0.9,0.3,0.2), material=materials.plastic) wand = box(pos=(550,60,-40), length=50, height=120, width=1, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) wand = box(pos=(550,60,260), length=50, height=120, width=1, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) wand = box(pos=(575,60,110), length=1, height=120, width=300, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(430,-4,-35), radius=2,axis=(0,155,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(430,-4,255), radius=2,axis=(0,155,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(525,-4,-40), radius=2,axis=(0,135,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(525,-4,260), radius=2,axis=(0,135,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) class Car(frame): def __init__(self,pos=(0,0,0)): frame.__init__(self, pos=pos) self.unterboden=box(pos=(-18,0,0), length=(60), height=(1), width=(26),color=(0.3,0.3,0.3),frame=self) self.reifen1=ring(pos=(-36,0,-15),thickness=(2),radius=(5),axis=(0,0,1),color=(0.3,0.3,0.3),frame=self) self.reifen2=ring(pos=(0,0,-15),thickness=(2),radius=(5),axis=(0,0,1),color=(0.3,0.3,0.3),frame=self) self.reifen3=ring(pos=(-36,0,15),thickness=(2),radius=(5),axis=(0,0,1),color=(0.3,0.3,0.3),frame=self) self.reifen4=ring(pos=(0,0,15),thickness=(2),radius=(5),axis=(0,0,1),color=(0.3,0.3,0.3),frame=self) self.felge1=cylinder(pos=(-36,0,-15),radius=(5),length=(1),axis=(0,0,1),frame=self) self.felge1=cylinder(pos=(0,0,-15),radius=(5),length=(1),axis=(0,0,1),frame=self) self.felge1=cylinder(pos=(-36,0,15),radius=(5),length=(1),axis=(0,0,1),frame=self) self.felge1=cylinder(pos=(0,0,15),radius=(5),length=(1),axis=(0,0,1),frame=self) self.front=box(pos=(-52,3,0),size=(10,1,26),axis=(-1.3,1,0),color=(1,0.84,0),frame=self) self.front2=box(pos=(-56,8.5,0),size=(5,1,26),axis=(0,1,0),color=(1,0.84,0),frame=self) self.haube=box(pos=(-41.5,12.5,0),size=(30,1,26),axis=(1,0.1,0),color=(1,0.84,0),frame=self) self.scheibe=box(pos=(-26,18,0),size=(7,1,26),axis=(0.3,1,0),opacity=(0.5),frame=self) self.dach=box(pos=(-18,21,0),size=(15,1,26),axis=(1,0,0),color=(1,0.84,0),frame=self) self.dach2=box(pos=(-4,19,0),size=(15,1,26),axis=(1,-0.3,0),color=(1,0.84,0),frame=self) self.heck=box(pos=(12,3,0),size=(7,1,26),axis=(0.2,1,0),color=(1,0.84,0),frame=self) self.dach3=box(pos=(8,15,0),size=(10,1,26),axis=(1,-0.4,0),color=(1,0.84,0),frame=self) self.heck2=box(pos=(13,10,0),size=(7,1,26),axis=(0,1,0),color=(1,0.84,0),frame=self) self.spoiler=box(pos=(16,13,00),size=(7,1,26),axis=(1,0.3,0),color=(1,0.84,0),frame=self) self.spoiler2=box(pos=(16,14,0),size=(7,1,26),axis=(1,0.2,0),color=(1,0.84,0),frame=self) seite1=frame(frame=self) seitenwand=Polygon([(0,0),(-8,6),(-8,11),(22,14),(37,14),(39,20),(53,16),(60,14),(61,12),(61,5),(60,0) ]) straight = [(0,0,0),(0,0,-1)] self.wand=extrusion(pos=straight, shape=seitenwand, color=(1,0.84,0),frame=seite1) seite1.pos=(-48,0,-12) seite2=frame(frame=self) seitenwand=Polygon([(0,0),(-8,6),(-8,11),(22,14),(37,14),(39,20),(53,16),(60,14),(61,12),(61,5),(60,0) ]) straight = [(0,0,0),(0,0,-1)] self.wand2=extrusion(pos=straight, shape=seitenwand,color=(1,0.84,0),frame=seite2) seite2.pos=(-48,0,13) self.birne=sphere(pos=(-53,12,-9),radius=2,material=materials.emissive,frame=self) self.licht=sphere(pos=(-52,12,-9),radius=2.4,color=(1,0.84,0),frame=self) self.birne2=sphere(pos=(-53,12,9),radius=2,material=materials.emissive,frame=self) self.licht2=sphere(pos=(-52,12,9),radius=2.4,color=(1,0.84,0),frame=self) self.kuehler=box(pos=(-56.4,8.5,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.kuehler=box(pos=(-56.4,9,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.kuehler=box(pos=(-56.4,9.5,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.kuehler=box(pos=(-56.4,10,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.kuehler=box(pos=(-56.4,8,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.kuehler=box(pos=(-56.4,7.5,0),color=(0,0,0),axis=(0,1,0),frame=self,size=(0.2,0.3,20)) self.licht=sphere(pos=(12.5,1,-10),radius=0.5,color=(0.7,0,0),material=materials.emissive,frame=self) self.licht=sphere(pos=(12.5,1,10),radius=0.5,color=(0.7,0,0),material=materials.emissive,frame=self) car=Car() car.pos=car.pos+(370,7,42) car.axis=(0,0,1) scene3 = display(x=1000, y=1000, width=350, height=300,center=(0,0,0), title='Uebersicht' ) for obj in scene.objects: try: obj.__copy__(display=scene3) except: pass scene3.forward = (0,-1,0) scene3.range=600 scene3.select() trib=frame(axis=(-0.5,0,0.5)) stufe = box(pos=(500,3.5,110), length=150, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(510,13.5,110), length=130, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(520,23.5,110), length=110, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(530,33.5,110), length=90, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(540,43.5,110), length=70, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) stufe = box(pos=(550,53.5,110), length=50, height=7, width=300, frame=trib, color=(0.7,0.6,0.6), material=materials.plastic) dach = box(pos=(500,135,110), length=150, height=1, width=300, frame=trib, axis=(1,-0.2, 0), color=(0.9,0.3,0.2), material=materials.plastic) wand = box(pos=(550,60,-40), length=50, height=120, width=1, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) wand = box(pos=(550,60,260), length=50, height=120, width=1, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) wand = box(pos=(575,60,110), length=1, height=120, width=300, frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(430,-4,-35), radius=2,axis=(0,155,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(430,-4,255), radius=2,axis=(0,155,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(525,-4,-40), radius=2,axis=(0,135,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) saeule = cylinder(pos=(525,-4,260), radius=2,axis=(0,135,0), frame=trib, color=(0.7,0.7,0.7), material=materials.plastic) carc=Car() carc.pos=carc.pos+(370,7,42) carc.axis=(0,0,1) i=0.000001 while i<8: rate(50) scene.center=(sin(i)*300, 100, cos(i)*200) scene.forward = (sin(i)*300-300, -300.0/i, cos(i)*150-300) i=i+0.01 if __name__ == "__main__" : rate(50) v=(0,0,0) vs=0 left=0 right=0 while True: rate(50) print vs if vs>=0.001: if scene.kb.keys: skk = scene.kb.getkey() if skk=='up': vs=vs+0.3 elif skk=='down': vs=vs-0.3 elif skk=='right': car.axis=car.axis.rotate(angle=-pi/32,axis=(0,1,0)) carc.axis=car.axis elif skk=='left': car.axis=car.axis.rotate(angle=pi/32,axis=(0,1,0)) carc.axis=car.axis v=-vs*car.axis car.pos=car.pos+v carc.pos=car.pos scene.center=car.pos scene.forward=-car.axis -vector(2,3,2) else: if scene.kb.keys: skk = scene.kb.getkey() if skk=='up': vs=vs+0.3 elif skk=='down': vs=vs-0.3 elif skk=='right': car.axis=car.axis.rotate(angle=-pi/32,axis=(0,1,0)) elif skk=='left': car.axis=car.axis.rotate(angle=pi/32,axis=(0,1,0)) print vs v=-vs*car.axis car.pos=car.pos+v carc.pos=car.pos scene.center=car.pos scene.forward=-car.axis -vector(2,3,2)