tilt = 0.0 avhgt = 2.0 xm = 0.0 zm = 0.0 ym = -(mymap.calcHeight(xm, zm) + avhgt) # Fetch key presses mykeys = pi3d.key() mymouse = pi3d.mouse() mymouse.start() mtrx = pi3d.matrix() omx = mymouse.x omy = mymouse.y myfog = pi3d.fog(0.002, (0.3, 0.8, 0.6, 0.5)) mylight = pi3d.createLight(0, 1, 1, 1, "", 10, 10, 10, .9, .7, .6) # Display scene and rotate cuboid while 1: display.clear() mtrx.identity() #tilt can be used as a means to prevent the view from going under the landscape! if tilt < -1: sf = 1.0 / -tilt else: sf = 1.0 mtrx.translate(0, -10 * sf - 5.0, -40 * sf) #zoom camera out so we can see our robot mtrx.rotate(tilt, 0, 0) #Robot still affected by scene tilt #draw robot
tilt=0.0 avhgt = 2.0 xm=0.0 zm=0.0 ym= -(mymap.calcHeight(xm,zm)+avhgt) # Fetch key presses mykeys = pi3d.key() mymouse = pi3d.mouse() mymouse.start() mtrx = pi3d.matrix() omx=mymouse.x omy=mymouse.y myfog = pi3d.fog(0.002,(0.3,0.8,0.6,0.5)) mylight = pi3d.createLight(0,1,1,1,"",10,10,10, .9,.7,.6) # Display scene and rotate cuboid while 1: display.clear() mtrx.identity() #tilt can be used as a means to prevent the view from going under the landscape! if tilt<-1: sf=1.0/-tilt else: sf=1.0 mtrx.translate(0,-10*sf-5.0,-40*sf) #zoom camera out so we can see our robot mtrx.rotate(tilt,0,0) #Robot still affected by scene tilt #draw robot mylight.on()
avhgt = 2.0 xm=0.0 zm=0.0 ym= -(mymap.calcHeight(xm,zm)+avhgt) spc = 39.32 opendist = 120 # Fetch key presses mymouse = pi3d.mouse() mymouse.start() mtrx = pi3d.matrix() omx=mymouse.x omy=mymouse.y myfog = pi3d.fog(0.001,(0.65,0.1,0.3,0.5)) mylight = pi3d.createLight(0,1,1,1,"",100,100,100) #, .9,.7,.6) try: while 1: display.clear() mtrx.identity() #tilt can be used as a means to prevent the view from going under the landscape! if tilt<-1: sf=1.0/-tilt else: sf=1.0 mtrx.rotate(tilt,0,0) #Tilt scene #draw scene mtrx.rotate(0,mouserot,0)
ym= -(mymap.calcHeight(xm,zm)+avhgt) # enemy tank vars etx=50 etz=90 etr=0.0 # Fetch key presses mymouse = pi3d.mouse() mymouse.start() mtrx = pi3d.matrix() omx=mymouse.x omy=mymouse.y myfog = pi3d.fog(0.0014,(0.7,0.8,0.9,0.5)) mylight = pi3d.createLight(0,1,1,1,"",100,100,100) #, .9,.7,.6) def drawTiger(x,y,z,rot,roll,pitch,turrot,gunangle): tank_body.draw(None,None,x,y,z,pitch,rot,roll) tank_turret.draw(None,None,x,y,z,pitch,turrot,roll) tank_gun.draw(None,None,x,y,z,pitch,turrot,roll) fps=pi3d.FPS() smode=False pc=1 autodrive=False try: while 1:
rockimg1 = texs.loadTexture("textures/techy1.jpg") rockimg2 = texs.loadTexture("textures/rock1.png", True) tree2img = texs.loadTexture("textures/tree2.png") raspimg = texs.loadTexture("textures/Raspi256x256.png") # environment cube ectex = texs.loadTexture("textures/ecubes/skybox_stormydays.jpg") myecube = pi3d.createEnvironmentCube(900.0,"CROSS") # Create elevation map mapwidth=1000.0 mapdepth=1000.0 mapheight=110.0 mymap = pi3d.createElevationMapFromTexture("textures/maze1.jpg",mapwidth,mapdepth,mapheight,128,128,1,"sub",0,0,0, smooth=False) mymap2 = pi3d.createElevationMapFromTexture("textures/maze1.jpg",mapwidth,mapdepth,mapheight+0.1,128,128 ,64,"detail",0.0, 0.01, 0.0, smooth=True) myfog = pi3d.fog(0.02, (0.1,0.1,0.1,1.0)) #Create tree models treeplane = pi3d.createPlane(4.0,5.0) treemodel1 = pi3d.createMergeShape("baretree") treemodel1.add(treeplane, 0,0,0) treemodel1.add(treeplane, 0,0,0, 0,90,0) shed = pi3d.loadModel("models/shed1.obj",texs,"shed",0,3,0, 0,0,0, 2,2,2) #Scatter them on map using Merge shape's cluster function mytrees1 = pi3d.createMergeShape("trees1") mytrees1.cluster(treemodel1, mymap,0.0,0.0,900.0,900.0,10,"",8.0,3.0) # (shape,elevmap,xpos,zpos,w,d,count,options,minscl,maxscl) raspberry = pi3d.createMergeShape("rasp")