self._set_input()
self._set_mouse_plane()
Background()
- self.items = [Box(world)]
+ self.items = [Box(world, self._mouse_plane_node, 3, self.cb_inst)]
taskMgr.add(self.on_frame, 'on_frame')
def _set_camera(self):
def _get_hits(self):
if not base.mouseWatcherNode.has_mouse(): return []
- p_from = Point3() # in camera coordinates
- p_to = Point3() # in camera coordinates
+ p_from, p_to = Point3(), Point3() # in camera coordinates
base.camLens.extrude(base.mouseWatcherNode.get_mouse(), p_from, p_to)
p_from = render.get_relative_point(base.cam, p_from) # global coords
p_to = render.get_relative_point(base.cam, p_to) # global coords
[itm.on_mouse_move(pos) for itm in self.items]
return task.cont
+ def cb_inst(self, item):
+ self.items += [item]
+
def on_play(self):
[itm.play() for itm in self.items]