The problem I am having is that my model does not collide with the terrain (walk on land) during the interval. It does so only after the interval ends.
Can someone please tell me what I can do to correct this? Thanks
Intervals were not designed to be interactive. A pos interval sets an object’s position each frame based on a pre-calculated interpolation, rather than incrementing the position based on its current position.
This is great for turn-based combat animations distributed over a network (like in Toontown) or for pre-scripted sequences.
It is not good, however, for anything resembling interactive physics. You should write a task if you want increment a position every frame instead of setting it.
You can get some leeway by setting [color=darkred]bakeInStart to false and [color=darkred]fluid to true, but this is still not recommended for interactive physics.
See the manual page for exactly what these parameters do.
I have been studying PandaSteer in an effort to understand how to have a character move from one point to another on a collision mesh, but I started getting a headache, since I can’t begin to figure out how it was done. (I wish I could code like that. I see I have a tremendously long way to go)
I would like some help on getting this done in my game. I just want to have a character walk to a point, and stop when he gets there (using a collision mesh).
I got it working, thanks to your post Cyan.
My model now walks across the terrain during the interval.
However, I have one problem, because of the way my game is setup.
When the user exits the game, it is supposed to cleanup everything and
return to the main menu. So that when the user presses play, he enters
the game “with a clean slate”.
My problem is that everything has been cleaned up, except the collision
thing (the red thing that is seen when you uncomment
self.cTrav.showCollisions(render)). The used one is left behind, and a
new one create each time the game starts.
I am not sure, but I believe it has something to do with
self.playerZcol.traverse(render) in this code:
# Update Player Z (Keep player on Terrain)
def updatePlayerZ(self, time):
if self.page == 1:
startpos = self.Mod1.getPos()
self.playerZcol.traverse(render)
if self.playerZcolQueue.getNumEntries>0:
self.playerZcolQueue.sortEntries()
point = self.playerZcolQueue.getEntry
(0).getSurfacePoint(self.env)
self.Mod1.setZ(point.getZ())
else:
self.Mod1.setPos(startpos)
# End updatePlayerZ
Is there a code I can use to clean this up when I end the game?
Also, is there a code in Panda, that calls “restart game”?
Thanks