def show_redpill_scene(enabled): # any scene changes must not persist # show gridlines glen = arblib.GRIDLEN y = arblib.FLOOR_Y hcolor = arblib.rgb2hex(arblib.CLR_GRID) for z in range(-glen, glen + 1): name = "grid_z" + str(z) if enabled: arena.Object(objName=name, objType=arena.Shape.line, line=arena.Line((-glen, y, z), (glen, y, z), 1, hcolor)) else: arblib.delete_obj(REALM, SCENE, name) for x in range(-glen, glen + 1): name = "grid_x" + str(x) if enabled: arena.Object(objName=name, objType=arena.Shape.line, line=arena.Line((x, y, -glen), (x, y, glen), 1, hcolor)) else: arblib.delete_obj(REALM, SCENE, name) pobjs = arena.get_network_persisted_scene(BROKER, SCENE) for pobj in pobjs: obj = arblib.ObjectPersistence(pobj) # show occluded objects if obj.transparent_occlude: name = "redpill_" + obj.object_id if enabled: arena.Object( objName=name, objType=obj.object_type, location=obj.position, rotation=obj.rotation, scale=obj.scale, color=obj.color, clickable=True, url=obj.url, transparency=arena.Transparency(True, 0.5), ) print("Wrapping occlusion " + name) else: arblib.delete_obj(REALM, SCENE, name)
def draw_ray(click_pos, position): line = arena.Object( objName="", ttl=1, objType=arena.Shape.line, line=arena.Line( # slightly below camera so you can see line vs head-on (click_pos[0],click_pos[1]-0.1,click_pos[2]), (position[0],position[1],position[2]),1,"#FFFFFF") )
def create_line(self, pts1, pts2, name): x1 = pts1[0] y1 = pts1[1] + 2 x2 = pts2[0] y2 = pts2[1] + 2 line = arena.Line((x1, y1, -0.5), (x2, y2, -0.5), 2, "#ffffff") arena.Object(objName=name, objType=arena.Shape.line, line=line, persist=False)
def got_click(location): for name in drones: if drones[name].active == True: arena.Object(objName="line1", objType=arena.Shape.line, line=arena.Line(start=drones[name].location, end=location, color=(206, 0, 255)), ttl=2) break print("No drone selected")
def create_line(self, pts1, pts2, name): x1 = float(pts1[0]) * self.width y1 = float(pts1[1]) * self.height + self.height x2 = float(pts2[0]) * self.width y2 = float(pts2[1]) * self.height + self.height line = arena.Line((x1, y1, -0.5), (x2, y2, -0.5), 2, users[self.ID]["color"]) arena.Object(objName=name, objType=arena.Shape.line, line=line, persist=False)
def regline(object_id, axis, direction, delim, suffix, start, end, line_width, color=(255, 255, 255), parent=""): if parent: end = ((end[0] - start[0]) * 10, (end[1] - start[1]) * 10, (end[2] - start[2]) * 10) start = (0, 0, 0) name = (object_id + delim + axis + direction + "_" + suffix) CONTROLS[object_id][name] = (arena.Object( objType=arena.Shape.line, objName=name, color=color, ttl=arblib.TTL_TEMP, parent=parent, line=arena.Line(start, end, line_width, color)))
text.update(color=(0, 255, 0)) input("") arena.Object( objName="myLight", objType=arena.Shape.light, location=(1, 1, 1), rotation=(0.25, 0.25, 0.25, 1), color=(255, 0, 0), ) input("") arena.Object( objName="line1", objType=arena.Shape.line, line=arena.Line(start=(3, 2, -4), end=(3, 3, -4), color=(206, 0, 255)), ) input("") arena.Object( objName="line2", objType=arena.Shape.thickline, thickline=arena.Thickline(line_width=11, color=(255, 136, 238), path=[ (3, 4, -4), (4, 4, -4), (4, 5, -4), (4, 5, -5)]), ) input("") torus.update(physics=arena.Physics.dynamic) input("") torus.update(ttl=2)