Advertisement
Guest User

Untitled

a guest
Oct 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. def CheckCollide(self, task):
  2.        
  3.         startpos =  self.mainDog.dogModel.getPos()
  4.        
  5.         self.groundTraverser.traverse(render)
  6.        
  7.        
  8.        
  9.        
  10.         entries = []
  11.         for i in range(self.mainDog.gorundHandle.getNumEntries()):
  12.             entry = self.mainDog.gorundHandle.getEntry(i)
  13.             entries.append(entry)
  14.         entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(), x.getSurfacePoint(render).getZ()))
  15.        
  16.        
  17.         if (len(entries)>0) and (entries[0].getIntoNode().getName() == "Plane"):
  18.             self.mainDog.dogModel.setZ(entries[0].getSurfacePoint(render).getZ())
  19.         else:
  20.             self.mainDog.dogModel.setPos(startpos)
  21.        
  22.         self.floater.setPos(self.mainDog.dogModel.getPos())
  23.         self.floater.setZ(self.mainDog.dogModel.getZ() + 2.0)
  24.  
  25.         for a in range(self.numCows):        
  26.             cowEntries = []
  27.             for i in range(self.cows[a].gorundHandle.getNumEntries()):
  28.                 cowEntry = self.cows[a].gorundHandle.getEntry(i)
  29.                 cowEntries.append(cowEntry)
  30.             cowEntries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(), x.getSurfacePoint(render).getZ()))
  31.            
  32.            
  33.             startpos =  self.cows[a].cowModel.getPos()
  34.            
  35.             if (len(cowEntries)>0) and (cowEntries[0].getIntoNode().getName() == "Plane"):
  36.                 self.cows[a].cowModel.setZ(cowEntries[0].getSurfacePoint(render).getZ())
  37.                
  38.             else:
  39.                 self.cows[a].cowModel.setPos(startpos)
  40.                
  41.             #self.floater.setPos(self.cows[a].cowModel.getPos())
  42.             #self.floater.setZ(self.cows[a].cowModel.getZ()+2.0)
  43.    
  44.                
  45.        
  46.        
  47.         return task.cont
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement