ya2 · news · projects · code · about

fe07278144c47a04fc77b62e1f1a3ebfa9f92a57
[pmachines.git] / pmachines / items / domino.py
1 from panda3d.bullet import BulletBoxShape, BulletRigidBodyNode, BulletGhostNode
2 from pmachines.items.item import Item
3
4
5 class Domino(Item):
6
7 def __init__(self, world, plane_node, cb_inst, curr_bottom, repos, mass=1, pos=(0, 0, 0), r=0, count=0):
8 super().__init__(world, plane_node, cb_inst, curr_bottom, repos, 'assets/gltf/domino/domino.gltf', mass=mass, pos=pos, r=r, count=count)
9
10 def _set_shape(self):
11 self.node.add_shape(BulletBoxShape((.1, .25, .5)))
12
13
14 class TargetDomino(Domino):
15
16 def __init__(self, world, plane_node, cb_inst, curr_bottom, repos, mass=1, pos=(0, 0, 0), r=0, count=0, tgt_degrees=0):
17 self._tgt_degrees = tgt_degrees
18 super().__init__(world, plane_node, cb_inst, curr_bottom, repos, mass=mass, pos=pos, r=r, count=count)
19
20 def end_condition(self):
21 return abs(self._np.get_r()) >= self._tgt_degrees