Collision problem-panda fly

Hello
My name is Paul.
I live in Poland.
I have a problem.
I look Roaming Ralph Tutorial.
My panda fly, but I don’t know why.
I have a screenshot:







Screenshot:
megaupload.com/?d=V1CMYBAU

All files(~3MB):
megaupload.com/?d=T7KAEV1W

File with code:
megaupload.com/?d=6TFO43W2

import direct.directbase.DirectStart
from pandac.PandaModules import *
from pandac.PandaModules import CollisionTraverser,CollisionNode
from pandac.PandaModules import CollisionHandlerQueue,CollisionRay
from pandac.PandaModules import Filename
from pandac.PandaModules import PandaNode,NodePath,Camera,TextNode
from pandac.PandaModules import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
import random, sys, os, math
SPEED = 0.5

# light
plight = PointLight('plight')
plight.setColor(VBase4(0.5, 0.5, 0.5, 1))
plnp = render.attachNewNode(plight)
plnp.setPos(10, 10, 10)
render.setLight(plnp)

class World(DirectObject):

    def __init__(self):

        self.keyMap = {"left":0, "right":0, "forward":0}

# background, camera
        base.setBackgroundColor(0, 0, 0)
        camera.setPos (50,70,50)
        #camera.setHpr (10,-55,0)

# terrain
        self.environ = loader.loadModel("terrain")
        self.environ.reparentTo(render)
        self.environ.setScale(0.25,0.25,0.25)
        self.environ.setPos(0,0,0)

# player
        pandaStartPos = self.environ.find("**/start_point").getPos()
        self.panda = Actor("panda-model")
        self.panda.reparentTo(render)
        self.panda.setScale(0.0025)
        self.panda.setPos(pandaStartPos)

# disable mouse, camera
        base.disableMouse()
        #base.useDrive()
        base.camera.setPos(self.panda.getX(),self.panda.getY()+10,2)
        #base.camera.lookAt(self.panda)

# Create a floater object.  We use the "floater" as a temporary
# variable in a variety of calculations.
        self.floater = NodePath(PandaNode("floater"))
        self.floater.reparentTo(render)

# Accept the control keys for movement and rotation
        self.accept("escape", sys.exit)
        self.accept("a", self.setKey, ["left",1])
        self.accept("d", self.setKey, ["right",1])
        self.accept("w", self.setKey, ["forward",1])

        self.accept("a-up", self.setKey, ["left",0])
        self.accept("d-up", self.setKey, ["right",0])
        self.accept("w-up", self.setKey, ["forward",0])

        taskMgr.add(self.move,"moveTask")

# Game state variables
        #self.isMoving = False

# collision
        self.cTrav = CollisionTraverser()

        self.pandaGroundRay = CollisionRay()
        self.pandaGroundRay.setOrigin(0,0,1000)
        self.pandaGroundRay.setDirection(0,0,-1)
        self.pandaGroundCol = CollisionNode('pandaRay')
        self.pandaGroundCol.addSolid(self.pandaGroundRay)
        self.pandaGroundCol.setFromCollideMask(BitMask32.bit(0))
        self.pandaGroundCol.setIntoCollideMask(BitMask32.allOff())
        self.pandaGroundColNp = self.panda.attachNewNode(self.pandaGroundCol)
        self.pandaGroundHandler = CollisionHandlerQueue()
        self.cTrav.addCollider(self.pandaGroundColNp, self.pandaGroundHandler)

# camera collision
        #self.camGroundRay = CollisionRay()
        #self.camGroundRay.setOrigin(0,0,1000)
        #self.camGroundRay.setDirection(0,0,-1)
        #self.camGroundCol = CollisionNode('camRay')
        #self.camGroundCol.addSolid(self.camGroundRay)
        #self.camGroundCol.setFromCollideMask(BitMask32.bit(0))
        #self.camGroundCol.setIntoCollideMask(BitMask32.allOff())
        #self.camGroundColNp = base.camera.attachNewNode(self.camGroundCol)
        #self.camGroundHandler = CollisionHandlerQueue()
        #self.cTrav.addCollider(self.camGroundColNp, self.camGroundHandler)

#Records the state of the arrow keys
    def setKey(self, key, value):
        self.keyMap[key] = value

# Accepts arrow keys to move either the player or the menu cursor,
# Also deals with grid checking and collision detection
    def move(self, task):

# Get the time elapsed since last frame. We need this
# for framerate-independent movement.
        elapsed = globalClock.getDt()

# save ralph's initial position so that we can restore it,
# in case he falls off the map or runs into something.
        startpos = self.panda.getPos()

# If a move-key is pressed, move ralph in the specified direction.
        if (self.keyMap["left"]!=0):
            self.panda.setH(self.panda.getH() + elapsed*300)
        if (self.keyMap["right"]!=0):
            self.panda.setH(self.panda.getH() - elapsed*300)
        if (self.keyMap["forward"]!=0):
            self.panda.setY(self.panda, -(elapsed*2500))

# If the camera is too far from ralph, move it closer.
# If the camera is too close to ralph, move it farther.
        base.camera.lookAt(self.panda)
        camvec = self.panda.getPos() - base.camera.getPos()
        camvec.setZ(0)
        camdist = camvec.length()
        camvec.normalize()
        if (camdist > 10.0):
            base.camera.setPos(base.camera.getPos() + camvec*(camdist-10))
            camdist = 10.0

#################################################
# player can't move
        #if (camdist < 5.0):
            #base.camera.setPos(base.camera.getPos() - camvec*(5-camdist))
            #camdist = 5.0
#################################################

# Now check for collisions.
        self.cTrav.traverse(render)

# Adjust ralph's Z coordinate.  If ralph's ray hit terrain,
# update his Z. If it hit anything else, or didn't hit anything, put
# him back where he was last frame.
        entries = []
        for i in range(self.pandaGroundHandler.getNumEntries()):
            entry = self.pandaGroundHandler.getEntry(i)
            entries.append(entry)
        entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(),
                                     x.getSurfacePoint(render).getZ()))
        if (len(entries)>0) and (entries[0].getIntoNode().getName() == "terrain"):
            self.panda.setZ(entries[0].getSurfacePoint(render).getZ())
        else:
            self.panda.setPos(startpos)

# Keep the camera at one foot above the terrain,
# or two feet above ralph, whichever is greater.
        #entries = []
        #for i in range(self.camGroundHandler.getNumEntries()):
        #    entry = self.camGroundHandler.getEntry(i)
        #    entries.append(entry)
        #entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(),
        #                             x.getSurfacePoint(render).getZ()))
        #if (len(entries)>0) and (entries[0].getIntoNode().getName() == "terrain"):
        #    base.camera.setZ(entries[0].getSurfacePoint(render).getZ()+1.0)
        #if (base.camera.getZ() < self.panda.getZ() + 2.0):
        #    base.camera.setZ(self.panda.getZ() + 2.0)

# The camera should look in ralph's direction,
# but it should also try to stay horizontal, so look at
# a floater which hovers above ralph's head.
        self.floater.setPos(self.panda.getPos())
        self.floater.setZ(self.panda.getZ() + 2.0)
        base.camera.lookAt(self.floater)

        return Task.cont

w = World()
run()

Thanks for help.

I suggest you make the screen brighter and use “Code” tag for your code posted in the forum.

I have one more question.
When I uncomment this line panda can’t move.
Why?

#################################################
# player can't move
        #if (camdist < 5.0):
            #base.camera.setPos(base.camera.getPos() - camvec*(5-camdist))
            #camdist = 5.0