autorennen
automitrunhangt.py — text/python-source, 22 KB (23504 bytes)
Dateiinhalt
from visual import * from math import * from threading import Thread from random 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 = 200 # 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 = 2 # Kamerawinkeloeffnung: norm. 1 scene.fullscreen = False # Vollbild? norm. False scene.title = "Koordinaten" # Fenstertitel scene.width = 500 # Fensterbreite: norm. 200 scene.height = 500 # Fensterhoehe: norm 200 scene.x = 50 # x-Koordinate d. Fensters: norm. 0 scene.y = 25 # 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) decke = box(pos=(0,500,0), width=1000, height=1, length=1200, color=(0.1,0.5,0.9)) 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,0,0), width=1000, height=1000, length=2, color=(0.1,0.5,0.9)) wand=box(pos=(0,0,500), width=2, height=1000, length=1200, color=(0.1,0.5,0.9)) wand=box(pos=(-600,0,0), width=1000, height=1000, length=2, color=(0.1,0.5,0.9)) wand=box(pos=(0,0,-500), width=2, height=1000, length=1200, color=(0.1,0.5,0.9)) 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),) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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 Car2(frame,Thread): def __init__(self,pos=(0,0,0)): frame.__init__(self,pos=pos) Thread.__init__(self) self.reifen1 = ring(pos=(-40,5,-15), axis=(0,0,1), radius=5, thickness=2, color=color.black, frame=self) self.reifen2 = ring(pos=(0,5,-15), axis=(0,0,1), radius=5, thickness=2, color=color.black, frame=self) self.reifen3 = ring(pos=(-40,5,15), axis=(0,0,1), radius=5, thickness=2, color=color.black, frame=self) self.reifen4 = ring(pos=(0,5,15), axis=(0,0,1), radius=5, thickness=2, color=color.black, frame=self) self.reifen1i = cylinder(pos=(-40,5,-15),axis=(0,0,1),radius=3, color=color.black, frame=self) self.reifen2i = cylinder(pos=(0,5,-15),axis=(0,0,1),radius=3, color=color.black, frame=self) self.reifen3i = cylinder(pos=(-40,5,15),axis=(0,0,1),radius=3, color=color.black, frame=self) self.reifen4i = cylinder(pos=(0,5,15),axis=(0,0,1),radius=3, color=color.black, frame=self) self.boden = box(pos=(-20,5,0),length=60,height=1, width=26, color=(0,0.5,0), frame=self) self.frontg = box(pos=(-51,10,0),length=10,height=1, width=26,axis=(-0.3,1,0), color=(0,0.5,0), frame=self) self.frontw = box(pos=(-51,10,0),length=8,height=1, width=24,axis=(-0.3,1,0), color=color.white, frame=self) self.motorg = box(pos=(-40,16,0),length=25,height=1, width=26,axis=(1,0.1,0), color=(0,0.5,0), frame=self) self.motorw = box(pos=(-40,16,0),length=23,height=1, width=24,axis=(1,0.1,0), color=color.white, frame=self) self.scheibe = box(pos=(-24,21,0),length=10,height=1, width=26,axis=(0.8,1,0), color=color.black, frame=self) self.dachw = box(pos=(-6,25,0),length=30,height=1, width=26,axis=(1,0,0), color=color.white, frame=self) self.dachg = box(pos=(-6,25,0),length=28,height=1, width=24,axis=(1,0,0), color=(0,0.5,0), frame=self) self.heckug = box(pos=(10,10,0),length=10,height=1, width=26,axis=(0,1,0), color=(0,0.5,0), frame=self) self.heckuw = box(pos=(10,10,0),length=8,height=1, width=24,axis=(0,1,0), color=color.white, frame=self) self.hecko = box(pos=(8,20,0),length=10,height=1, width=26,axis=(-0.2,0.5,0), color=(0,0.5,0), frame=self) self.heckos = box(pos=(8,20,0),length=8,height=1, width=24,axis=(-0.2,0.5,0), color=color.black, frame=self) seiter = Polygon( [(10,5), (10,15), (6.5,25),(-10,25), (-10,17), (-28,17),(-52,15), (-50,5)] ) straight = [(0,0,-12),(0,0,-13)] extrusion(pos=straight, shape=seiter, color=(0,0.5,0), frame=self) seitel = Polygon( [(10,5), (10,15), (6.5,25),(-10,25), (-10,17), (-28,17),(-52,15), (-50,5)] ) straight = [(0,0,13),(0,0,12)] extrusion(pos=straight, shape=seitel, color=(0,0.5,0), frame=self) fensterl = Polygon( [ (-10,25), (-10,17), (-28,17),(-21,25)] ) straight = [(0,0,13),(0,0,12)] extrusion(pos=straight, shape=fensterl, color=color.black, frame=self) fensterr = Polygon( [ (-10,25), (-10,17), (-28,17),(-21,25)] ) straight = [(0,0,-12),(0,0,-13)] extrusion(pos=straight, shape=fensterr, color=color.black, frame=self) self.vllicht = sphere(pos=(-52,10,-10),material = materials.emissive, frame=self, color=color.yellow, radius=2) self.vrlicht = sphere(pos=(-52,10,10),material = materials.emissive, frame=self, color=color.yellow, radius=2) self.hllicht = sphere(pos=(10,10,-10),material = materials.emissive, frame=self, color=color.red, radius=2) self.hrlicht = sphere(pos=(10,10,10),material = materials.emissive, frame=self, color=color.red, radius=2) self.kennzeichenv = box(pos=(-51,10,0),length=3,height=1, width=8,axis=(-0.3,1,0), color=color.black, frame=self) self.kennzeichenh = box(pos=(10,10,0),length=3,height=1, width=8,axis=(0,1,0), color=color.black, frame=self) blaulichts = cylinder(pos=(-15,25,10), radius=1, length=2, color=color.black, axis=(0,1,0), frame=self) blaulichtl = sphere(pos=(-15,27,10), radius=1,color=color.blue,material = materials.emissive, frame=self) def run(self): g=(0,0,0) gs=0 global skk while True: skk = scene.kb.getkey() if gs>=0.01: if skk=='w': gs=gs+0.1 elif skk=='s': gs=gs-0.1 if skk=='d': self.axis=self.axis.rotate(angle=-pi/32,axis=(0,1,0)) if skk=='a': self.axis=self.axis.rotate(angle=pi/32,axis=(0,1,0)) g=-gs*self.axis self.pos=self.pos+g else: if skk=='w': gs=gs+0.1 elif skk=='s': gs=gs-0.1 g=-gs*self.axis self.pos=self.pos+g class Car(frame,Thread): def __init__(self,pos=(0,0,0)): frame.__init__(self, pos=pos) Thread.__init__(self) 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) def run(self): v=(0,0,0) vs=0 global skk while True: skk = scene.kb.getkey() if vs>=0.01: if skk=='up': vs=vs+0.1 elif skk=='down': vs=vs-0.1 if skk=='right': self.axis=self.axis.rotate(angle=-pi/32,axis=(0,1,0)) if skk=='left': self.axis=self.axis.rotate(angle=pi/32,axis=(0,1,0)) v=-vs*self.axis self.pos=self.pos+v else: if skk=='up': vs=vs+0.1 elif skk=='down': vs=vs-0.1 v=-vs*self.axis self.pos=self.pos+v car2=Car2() car=Car() car2.pos=car2.pos+(320,2,42) car.pos=car.pos+(370,7,42) car.axis=(0,0,1) car2.axis=(0,0,1) '''i=0.000001 while i<8: rate(30) 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) skk="" car2.start() car.start() ''' scene2 = display(x=700, y=25, width=500, height=500,center=(5,0,0), title='Spieler2') scene3 = display(x=500, y=25, width=300, height=300,center=(5,0,0), title='uebersicht' ) scene2.select() for obj in scene.objects: try: obj.__copy__(display=scene2) obj.__copy__(display=scene3) except: pass scene2.forward = (-1,-1,-1) scene2.range=120 car2b=Auto() car2b.pos=car2b.pos+(350,8,0) car2b.axis=(0,0,1) carb=Auto2() carb.pos=carb.pos+(380,8,0) carb.axis=(0,0,1) scene3.forward = (0,-1,0) scene3.range=500 scene3.select() car2c=Auto() car2c.pos=car2c.pos+(350,8,0) car2c.axis=(0,0,1) carb=Auto2() carb.pos=carb.pos+(380,8,0) carb.axis=(0,0,1) i=0.000001 while i<8: rate(50) scene.center=(sin(i)*300, 100, cos(i)*200) scene2.center=(sin(i)*300, 100, cos(i)*200) scene.forward = (sin(i)*300-300, -300.0/i, cos(i)*150-300) scene2.forward = (sin(i)*300-300, -300.0/i, cos(i)*150-300) i=i+0.01 '''