Example #1
0
 def nearest_point(self,
                   pos=(0,0,0),  # query position, in panda3d coordinates
                   radius=5):    # query radius
     """
     Find the nearest point on a navigable polygon in the navmesh. 
     Returns a tuple of (polyref,point).
     """
     radius = pyrecast.dtPoint3(radius,radius,radius)
     tmp_polyref = pyrecast.new_uintp(1)
     tmp_point = pyrecast.dtPoint3(0,0,0)
     self.query.findNearestPoly(panda2detour(pos),radius,self.filter,tmp_polyref,tmp_point) #.disown()
     return [tmp_polyref,tmp_point]
Example #2
0
 def nearest_point(
         self,
         pos=(0, 0, 0),  # query position, in panda3d coordinates
         radius=5):  # query radius
     """
     Find the nearest point on a navigable polygon in the navmesh. 
     Returns a tuple of (polyref,point).
     """
     radius = pyrecast.dtPoint3(radius, radius, radius)
     tmp_polyref = pyrecast.new_uintp(1)
     tmp_point = pyrecast.dtPoint3(0, 0, 0)
     self.query.findNearestPoly(panda2detour(pos), radius, self.filter,
                                tmp_polyref, tmp_point)  #.disown()
     return [tmp_polyref, tmp_point]
Example #3
0
 def nearest_edge_point(self,
                        loc,          # in detour coordinates; as returned by, for example, nearest_point (format: [polyref,point])
                        radius=5      # query radius
                        ):
     """
     Find the nearest edge point for a given location (location as returned by nearest_point()) 
     Returns a tuple of (polyref,point), i.e. same format as nearest_point()
     """
     tmp_point = pyrecast.dtPoint3(0,0,0)
     self.query.closestPointOnPolyBoundary(pyrecast.uintp_getitem(loc[0],0), loc[1], tmp_point) #.disown()
     return [loc[0],tmp_point]
Example #4
0
 def nearest_edge_point(
     self,
     loc,  # in detour coordinates; as returned by, for example, nearest_point (format: [polyref,point])
     radius=5  # query radius
 ):
     """
     Find the nearest edge point for a given location (location as returned by nearest_point()) 
     Returns a tuple of (polyref,point), i.e. same format as nearest_point()
     """
     tmp_point = pyrecast.dtPoint3(0, 0, 0)
     self.query.closestPointOnPolyBoundary(pyrecast.uintp_getitem(
         loc[0], 0), loc[1], tmp_point)  #.disown()
     return [loc[0], tmp_point]
Example #5
0
def panda2detour(pos):
    """Convert a point from the Panda3d to detour coordinate system."""
    return pyrecast.dtPoint3(pos[0], pos[2], -pos[1])
Example #6
0
def panda2detour(pos):
    """Convert a point from the Panda3d to detour coordinate system."""
    return pyrecast.dtPoint3(pos[0],pos[2],-pos[1])