Hi, i’m still trying to get collision in my game to work XD I tried using examples to help me getting collision but for some reason it still wont work, or part-ly wont work. I get the walls working but the floor wont seem to “push” back the camera and I also get the following error-?
:util(warning): Adjusting global clock's real time by 1.81198e-005 seconds.
:collide(error): Invalid points in CollisionPolygon:
160.585 -17320.2 1175.5
151.585 -17329.2 1157.5
157.585 -17323.2 1169.5
normal 2 0 0 with length 2
:collide(error): Invalid points in CollisionPolygon:
-352.415 -17323.2 956.501
-340.415 -17329.2 950.501
-346.415 -17326.2 953.501
normal 0 -0.03125 0.5 with length 0.500976
:util(warning): Adjusting global clock's real time by -17.2893 seconds.
I am also turning my .x files into .egg files so i’m not sure if thats what is messing up the collision. userdefined1002 is all the things in my map under one thing so I didn’t have to keep typing out { Polyset keep descend } over and over again.
<Group> userdefined1002 {
<Collide> { Polyset keep descend }
<VertexPool> userdefined1002 {
<Vertex> 0 {
832 -192 -5888
<UV> { -3.25 0.25 }
<Normal> { -0.57735 0.57735 0.57735 }
more down the line-
As for the code here it is…
def Collisions(self):
base.cTrav = CollisionTraverser()
base.pusher = CollisionHandlerPusher()
self.cn = CollisionNode('player')
self.cn.addSolid(CollisionSphere(0,0,0,2))
self.solid = self.node.attachNewNode(self.cn)
base.cTrav.addCollider(self.solid,base.pusher)
base.pusher.addCollider(self.solid,self.node, base.drive.node())
# init players floor collisions
self.ray = CollisionRay()
self.ray.setOrigin(0,-.5,0)
self.ray.setDirection(0,-.5,0)
self.cn = CollisionNode('playerRay')
self.cn.addSolid(self.ray)
self.cn.setFromCollideMask(BitMask32.bit(0))
self.cn.setIntoCollideMask(BitMask32.allOff())
self.solid = self.node.attachNewNode(self.cn)
self.nodeGroundHandler = CollisionHandlerQueue()
base.cTrav.addCollider(self.solid, self.nodeGroundHandler)
base.cTrav.setRespectPrevTransform(True)