I have a GeoMipTerrain and a flying ship. The flying ship has some collision spheres with the same collide mask that has the root of GeoMipTerrain and a CollisionHandlerEvent that is called when a collision is detected. The problem is that even if the ship isn’t touching the terrain a collision is detected always, so I see all the time in the console that a collision has been detected!
Here is a print of the collision entry:
CollisionEntry:
from render/level2/shipSvB1.egg/playerActorColNode
into render/level2/myDynamicTerrain/gmm3x2 []
at 200.353 150.354 -8.58662
normal 0.00639738 -0.00295264 99.9975
interior 200.347 150.357 -105.177 (depth 96.5903)
respect_prev_transform = 0
The normal of the collision is always close to 0,0,100 and the ship isn’t touching the generated terrain, in fact the ship is flying over the terrain.
Some code:
terrain update function:
def updateTerrain(self,task):
self.terrain.getRoot().setCollideMask(BitMask32.bit(0))
self.terrain.update()
return task.cont
actor :
self.ColNode = self.node.attachNewNode(CollisionNode('playerActorColNode'))
self.ColNode.node().addSolid(CollisionSphere(0,-0.5,-2,1.1))
self.ColNode.node().addSolid(CollisionSphere(-2.5,-0.5,-3,0.7))
self.ColNode.node().addSolid(CollisionSphere(2.5,-0.5,-3,0.7))
self.node.reparentTo(self.level.levelNode)
self.ColNode.node().setCollideMask(BitMask32.bit(0))
self.traverser = CollisionTraverser('traverser')
base.cTrav = self.traverser
self.playerActor.collisionHandler = CollisionHandlerEvent()
self.playerActor.collisionHandler.addInPattern('actorCollision')
self.accept('actorCollision',self.collisionEvent)
self.traverser.addCollider(self.playerActor.ColNode, self.playerActor.collisionHandler)
I’ve been a lot of time trying to solve this problem… Please help!!