Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1.  
  2.     def setup_wall_collision(self,playerob):
  3.         self.b.cTrav=CollisionTraverser() #ok so because this is the defautl
  4.         #I don't have to call some "traverse" method
  5.         self.CHP=CollisionHandlerPusher() #which means this should be filled
  6.         self.col_Node=CollisionNode("sphere")
  7.        
  8.         self.col_NodeNP=playerob.attachNewNode(self.col_Node)# I think char object/geom goes here with attachNode
  9.         self.col_NodeNP.set_tag("player_col_tag","player_col_tag_value")
  10.        
  11.         self.col_Node.setFromCollideMask(BitMask32.bit(3))
  12.         self.col_Node.setIntoCollideMask(BitMask32.bit(0))
  13.        
  14.         self.col_body=CollisionSphere((0,0,0),2)
  15.        
  16.        
  17.         self.col_Node.addSolid(self.col_body)
  18.         self.CHP.addCollider(self.col_NodeNP,playerob)
  19.         self.CHP.addInPattern("wall in")
  20.         self.CHP.addOutPattern("wall out")
  21.         self.CHP.addAgainPattern("wall again")
  22.         self.b.cTrav.addCollider(self.col_NodeNP,self.CHP)
  23.         self.event_handler.accept("wall in",self.wall_in)
  24.         self.event_handler.accept("wall out",self.wall_out)
  25.         self.event_handler.accept("wall again",self.wall_again)
  26. def wall_again(self,*args):
  27.         print("wall again")
  28.         print(args)
  29.         for x in args:
  30.            
  31.             print(x)
  32.         a=1
  33.  
  34. output
  35.  
  36. wall again
  37. (render/AvatarArm/sphere into render/Object at 0.471405 5 0,)
  38. CollisionEntry:
  39.   from render/AvatarArm/sphere
  40.   into render/Object [wall]
  41.   at 0.471405 5 0
  42.   normal 0 -1 0
  43.   interior 0.471405 5.1214 0 (depth 0.121405)
  44.   respect_prev_transform = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement