def adjust_move_target(self, idx, loc): """ Adjust the current move target for agent #idx. The location must have been resolved via e.g. NavMesh.nearest_point() and is in detour coordinates. """ self.crowd.adjustMoveTarget(idx, pyrecast.uintp_getitem(loc[0], 0), loc[1])
def is_reachable(self, a, # in panda3d coordinates b, # in panda3d coordinates tolerance=0.5, max_path=1000 ): """ Check if two points are reachable from each other. """ a = self.nearest_point(a,radius=tolerance) b = self.nearest_point(b,radius=tolerance) tmp_path = pyrecast.new_uintp(max_path) tmp_pathcount = pyrecast.new_intp(1) status = self.query.findPath(pyrecast.uintp_getitem(a[0],0),pyrecast.uintp_getitem(b[0],0),a[1],b[1],self.filter, tmp_path, tmp_pathcount, int(max_path)) #result = not ((pyrecast.uintp_getitem(status,0) & (1<<30)) == 0) result = pyrecast.dtStatusSucceed(status) #status.disown() return result
def is_reachable( self, a, # in panda3d coordinates b, # in panda3d coordinates tolerance=0.5, max_path=1000): """ Check if two points are reachable from each other. """ a = self.nearest_point(a, radius=tolerance) b = self.nearest_point(b, radius=tolerance) tmp_path = pyrecast.new_uintp(max_path) tmp_pathcount = pyrecast.new_intp(1) status = self.query.findPath(pyrecast.uintp_getitem(a[0], 0), pyrecast.uintp_getitem(b[0], 0), a[1], b[1], self.filter, tmp_path, tmp_pathcount, int(max_path)) #result = not ((pyrecast.uintp_getitem(status,0) & (1<<30)) == 0) result = pyrecast.dtStatusSucceed(status) #status.disown() return result
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]
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]
def adjust_move_target(self,idx,loc): """ Adjust the current move target for agent #idx. The location must have been resolved via e.g. NavMesh.nearest_point() and is in detour coordinates. """ self.crowd.adjustMoveTarget(idx,pyrecast.uintp_getitem(loc[0],0),loc[1])