The Ghost Player

I went through a lot of trouble to get the camera and the player to collide with the wall properly, and now that it works, the player can just slip through the wall if I run up against it long enough. Any ideas how to prevent something like this from happening? My code is horrible at this point since I barely got it together and working, so I made an even simpler version that pretty much does the same thing:

        self.cTrav.traverse(render)
        entries = []

        for i in range(self.playerGroundHandler.getNumEntries()):
            entry = self.playerGroundHandler.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"):
                h = entries[0].getSurfacePoint(render).getZ()
                self.c_node.setZ(h)
                if not self.jump:
                    self.player.setZ(h)
            else:
                self.c_node.setPos(startpos)
                if not self.jump:
                    self.player.setPos(startpos)

        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"):
                h = entries[0].getSurfacePoint(render).getZ()
                self.c_node.setZ(h)
                if not self.jump:
                    self.c_node.setZ(h)
            else:
                self.c_node.setPos(startpos)
                if not self.jump:
                    self.c_node.setPos(startpos)

have you read this section :
www.panda3d.org/manual/index.php/Rapid … ng_Objects

sample :
discourse.panda3d.org/viewtopic.php?t=4068

you may need to combine it with this :
discourse.panda3d.org/viewtopic.php?t=1228

Ooh, thanks, I only partially skimmed that, but haven’t read it thoroughly. I read a post before (I believe you wrote it) where you talked about a character moving fast, but the funny thing is… This character isn’t moving fast. I will definitely look into this more, seeing as how you suggested it and haven’t been wrong so far.

Edit: Would this lower the frame rates dramatically (or even significantly)? Currently I’m getting 100-150 on my crappy computer and I have been working hard at maintaining this. My limit is 90 FPS, and I’ve noticed that adding things like fluid collisions or spheres (and the position prediction, but can’t remember what it’s called).

I’m asking in advance because:

-almost done with this code and if I can make 90FPS or higher, I will save tons of time
-in case of major slow downs, I want to be sure that it’s not the feature itself but my code

It won’t much affect your frame rate. The collision computation is pretty much the same thing whether you have it on or off. The only difference is the bounding volume of your spheres gets a little larger–a lot larger, if they are moving fast.

I wonder whether it makes much sense to target a frame rate that is higher than your video rate, however. Computing frames faster than your monitor can display them just wastes CPU and introduces artifacts like tearing and latency.

David

I know what you mean, but I am aiming at a higher frame rate for what I am currently doing because I know for a fact that when I actually implement the code the FPS will drop like mad. Supposedly the one who did the tests assured me that anything about 90+ at this point would make 60 when it was used… Another test showed that 150 was the maximum that should be used. Anything above that would, as you said, cause tearing. Latency is actually what they are working to prevent. I don’t argue much with what the networking guys say as I don’t have the experience or background needed to determine if what they say is true or not. However, everything turns out good in the end, so I leave them to what they do… :laughing:

Thank you very much for responding, and I’m glad to say that the FPS hasn’t really changed much, although it did drop to 95-110. Odds are this is due to the “dynamic sun” that I’ve created for this demo.