Commit | Line | Data |
---|---|---|
1be87278 FC |
1 | from panda3d.bullet import BulletBoxShape, BulletRigidBodyNode |
2 | ||
3 | class Box: | |
4 | ||
5 | def __init__(self, world): | |
6 | shape = BulletBoxShape((.5, .5, .5)) | |
7 | self.node = BulletRigidBodyNode('box') | |
8 | # self.node.set_mass(1) # static/dynamic | |
9 | self.node.add_shape(shape) | |
10 | np = render.attach_new_node(self.node) | |
11 | np.set_pos(0, 0, 1) | |
12 | world.attach_rigid_body(self.node) | |
13 | model = loader.load_model('assets/gltf/box/box.gltf') | |
14 | model.flatten_light() | |
15 | model.reparent_to(np) | |
16 | ||
17 | def on_click(self, hit): | |
18 | print(hit.get_hit_pos()) |