I have a collision segment.
self.manGroundRay = CollisionSegment(0,0,100,0,0,-1) self.manGroundCol = CollisionNode('manRay') self.manGroundCol.addSolid(self.manGroundRay) self.manGroundCol.setFromCollideMask(BitMask32.bit(0)) self.manGroundCol.setIntoCollideMask(BitMask32.allOff()) self.manGroundColNp = self.man.attachNewNode(self.manGroundCol) It is assigned to a collision handler queue. Code: base.cTrav.addCollider(self.manGroundColNp, self.manGroundHandler) base.cTrav.showCollisions(render)
this segment makes my avatar be able to move around on uneven terrain by using this line
if (len(entries)>0) and (entries.getIntoNode().getName() == "terrain"): self.man.setZ(entries.getSurfacePoint(render).getZ())
When I made the Collision Segment visible it appeared to originate from the centre of man and follow him around when his co-ordinates changed.
But that seemed to only happen with the X and Y because when the terrain my avatar’s walking over gets higher than the height of the collision Segment the Collision Segment stops being able to detect the terrain so man doesn’t get any higher.
so that prompted me to do this
and when I did this it showed that the coo-ordinates are always 0,0,0 but the Collision Segment will detect collisions no matter the X and Y but only the to what the height of the Collision Segment is in the Z.
so what I want to know is how to make it so that my Collision Segment follows my avatar up as it changes it’s Z co-ordinate changes instead of staying at 0.
and just a side note is there a way to ask if the Collision Segment is colliding with nothing?