A fly-prototype. Rate :)

Download here.

(don’t scare about the name view.py because it had to be something like Panda Viewer until I found it in the bin folder)

So, first(aka. TODO list Dany’s edition :slight_smile:):
1.)it’s big, it’s seriously very large text for this litlle code. I will make it much smaller
2.)It’s not “interactive”. Robo sayz: To add something interesting.
3.)Something like skybox needed
4.)Robo sayz…zzz: To add clouds. Nice&realistic clouds.
5.)Better lighting to go.

EDIT:
OK, I forgot there’s a bug or somewhat I didn’t like(I think it’s about the lighting colour) so I uploaded BAD version. Be free to edit. :sunglasses:

hm… i dont really see anything except a shuttering glowing white ship.
the code itself seems to make strange things,too. from what i see the ships movement is not really moving the ship like you usualy would want it to move. try to load an environment to see the actual movement of it.

also note that .bam files are not compatible across panda-versions. if you distribute files. please use .egg files.

if you read the describtion of the “code snippset” forum you might notice it’s for !working! code only. so if you have bugs in it, or if you are not sure it works.please don’t post it here. having semi-broken code in this section can easily confuse users (especially less experienced users).

:roll:

i mean ok it rotates. but it jumps forth and back quite a lot.
it’s just … i think what the code does is already in the manual and the samples (several times). well it’s a start, how about continue working on it and make something cool with it?

btw. nice ship, you should try to texture it.

Repair:

from direct.task import Task
from pandac.PandaModules import *
from direct.filter.CommonFilters import CommonFilters
from direct.interval.IntervalGlobal import *
import sys, random, direct.directbase.DirectStart
from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", "show-frame-rate-meter #t")
import psyco

psyco.full()
#Lighting

#

l = AmbientLight('al')
l.setColor(VBase4(0.7,0.7,0.81,1))
al = render.attachNewNode(l)
render.setLight(al)
p = PointLight('pl')
p.setColor(VBase4(1,
                  1,
                  1,
                  1))
pl = render.attachNewNode(p)
pl.setPos(0, 0, 100)
render.setLight(pl)

#Load the ship

#

viewm = loader.loadModel("ship.bam")
viewm.reparentTo(render)
x, y, z, h, p, r, s1, s2, s3 = 8, 16, 0, 0, 0, 0, 2, 2, 2
viewm.setPosHprScale(x,y,z,h,p,r,s1,s2,s3)

#Load the utah teapot

#

tpt = loader.loadModel("teapot")
tpt.reparentTo(render)
tpt.setPos(0, -600, 0)
#Bloom

#

render.setShaderOff()
filters = CommonFilters(base.win, base.cam) 
filters.setBloom(blend=(0,
                        0,
                        0,
                        1),
                 desat=-0.5,
                 intensity=3.0,
                 size=2)

#Move the ship

#
minterval1=viewm.posInterval(1,Vec3(0,-1000,0))
minterval1.loop()
def lean_right():
    minterval2=viewm.hprInterval(0.7,
                                 Vec3(1,
                                      0,
                                      -78))
    minterval2.start()
def lean_left():
    minterval3=viewm.hprInterval(0.7,
                                 Vec3(1,
                                      0,
                                      78))
    minterval3.start()
def go_up():
    minterval4=viewm.hprInterval(0.7,
                                 Vec3(0,
                                      -45,
                                      0))
    minterval4.start()
base.accept("d",lean_right)
base.accept("a",lean_left)
base.accept("s",go_up)

#Camera and....action!

#

base.disableMouse()
base.camera.lookAt(viewm)
def update_camera(task):
    rnd  = random.uniform(22.10000, 24.2)
    viewm.setScale(2,rnd/10,2)
    base.camera.setPos(viewm.getX(), viewm.getY()+rnd, viewm.getZ()+6)
    base.camera.lookAt(viewm)
    return task.again

upd_cam = taskMgr.doMethodLater(0.02,
                                update_camera,
                                'camera_repos')

#######
run()
#######

The ship is already textured :smiley: But it had some problems with exporting, hmm… :question:

Nice piece of code.
The ship stutters too bad (I assume you wanted to simulate the ship’s engines running) but replacing the last line with this works better:

upd_cam = taskMgr.add(update_camera, 'camera_repos')

I think it’s because my framerate is so high (540 fps) that this somehow influences the camera movement.
The ship’s texture is missing, you need to ship it as well (the file references a texture “…/Textures/ship06.jpg” or something like that, or we’ll only see a white ship. :slight_smile:

thanks pro-rsoft, another helpful post from you.

well the stuttering was meant to make an optical effect before I’d place there motion blur, and it works nice :slight_smile:

and why the textures were not included in the .egg file? no idea… :open_mouth:

oh, they were not supposed to be included… or did?

Yeah, the stutter gives a nice effect - but before I changed that line, there was way too much of it.
The .egg/.bam file does not contain textures itself - it only references them (e.g. contains a path to the texture). You still need to provide the texture files along with the model file.

Pygame is incompatible with python 2.5 it seems as well, so is psyco 8(

what has pygame to do with panda3d? especially with this thread??

Nm i had the wrong game