Hi, i’m a python developer and I’m trying to learn to use the panda3d engine.
I decided to start with Roaming Ralph, made him OO, added jumping, made some changes in the camera… and so far so good. Then i decided to play arround with the CollisionHandler, changing it to a CollisionHandlerFloor.
The jumping now it’s much easier, doesn’t need any special code for falling down… but every step ralph’s take into an uneven terrain, he bounces. The intensity and the time it will bouce depends on how much the setMaxVelocity is set… if it’s not set at all, the camera falls and you can only see the ground… if its 1, he bounces a little when he walks up, and he sloooowly falls when he walks back down, then he bouces again… if its 5 he allways stays on the ground bouncing, and higher it is he will bounce more. This is interesting, he stop bouncing at some time… if the velocity is 1, he will stop quickly, if its 50 it will take a lot longer.
I made some changes in the cam to see if it was a camera issue, but no.
Here is part of the code:
def setupCollisions (self):
base.cTrav = CollisionTraverser()
base.floor = CollisionHandlerFloor()
base.floor.setMaxVelocity(5)
#Ground Ray
self.ralphGroundCol = CollisionNode('ralphRay')
self.ralphGroundRay = CollisionRay()
self.ralphGroundRay.setOrigin(0,0,1000)
self.ralphGroundRay.setDirection(0,0,-1)
self.ralphGroundCol.addSolid(self.ralphGroundRay) #CollisionRay(0,0,0.0 , 0,0,0.05))
self.ralphGroundCol.setFromCollideMask(BitMask32.bit(0))
self.ralphGroundCol.setIntoCollideMask(BitMask32.allOff())
self.ralphGroundColNp = self.attachNewNode( self.ralphGroundCol)
#Linking Collider
base.cTrav.addCollider(self.ralphGroundColNp, base.floor)
base.floor.addCollider(self.ralphGroundColNp, self)
Any ideas ?
EDIT: A BETTER VIEW
Some observations:
Ralph bounces when he hit the ground. If he jumps on an even terrain, when he hit back the ground he bouces a little and stop. Then he start walking on the plane terrain and no bounce. This bounce seems like a landing thing, like a vibration made when a object hits the ground.
Also, i have noticed that when he walks up a terrain he sometimes automaticly “jumps” from one point to another instead of sliding like in the original example that had a code to make ralph’s Z the same as the collision point.
Those 2 observations can lead me to conclude that when something hits the ground, it will shake/bounce, and that when he walk on uneven terrains makes ralph “jump” from one point to another with a higher z than the hitting point thus making he hits the ground and then bounce.
Still… no idea how to solve it using CollisionHandlerFloor.