ya2 · news · projects · code · about

removed unused code
[pmachines.git] / ya2 / lib / bullet / bullet.py
CommitLineData
cb700bcc
FC
1# from panda3d.bullet import \
2# BulletWorld as BWorld, \
3# BulletDebugNode as BDebugNode, \
4# BulletTriangleMesh as BTriangleMesh, \
5# BulletTriangleMeshShape as BTriangleMeshShape, \
6# BulletRigidBodyNode as BRigidBodyNode, \
7# BulletGhostNode as BGhostNode
8ee66edd
FC
8
9
cb700bcc 10# class BulletPhysWorld:
8ee66edd 11
cb700bcc
FC
12# def __init__(self):
13# self._wld = BWorld()
14# self.__debug_np = None
8ee66edd 15
cb700bcc
FC
16# def attach_rigid_body(self, rbnode):
17# return self._wld.attach_rigid_body(rbnode)
8ee66edd 18
cb700bcc
FC
19# def remove_rigid_body(self, rbnode):
20# return self._wld.remove_rigid_body(rbnode)
8ee66edd 21
cb700bcc
FC
22# def attach_ghost(self, gnode): return self._wld.attach_ghost(gnode)
23# def remove_ghost(self, gnode): return self._wld.remove_ghost(gnode)
24# def attach_vehicle(self, vehicle): return self._wld.attach_vehicle(vehicle)
25# def remove_vehicle(self, vehicle): return self._wld.remove_vehicle(vehicle)
8ee66edd 26
cb700bcc
FC
27# def ray_test_closest(self, from_pos, to_pos, mask=None):
28# if mask is not None:
29# res = self._wld.ray_test_closest(from_pos, to_pos, mask)
30# else: res = self._wld.ray_test_closest(from_pos, to_pos)
31# return res
8ee66edd 32
cb700bcc
FC
33# def do_phys(self, dt, max_substeps, stepsize):
34# return self._wld.do_physics(dt, max_substeps, stepsize)
8ee66edd 35
cb700bcc 36# def set_gravity(self, vec): return self._wld.set_gravity(vec)
8ee66edd 37
cb700bcc
FC
38# def init_debug(self):
39# debug_node = BDebugNode('Debug')
40# debug_node.show_bounding_boxes(True)
41# self.__debug_np = render.attach_new_node(debug_node)
42# self._wld.set_debug_node(self.__debug_np.node())
8ee66edd 43
cb700bcc 44# def stop(self): self.__debug_np.remove_node()
8ee66edd 45
cb700bcc
FC
46# def ray_test_all(self, pt_a, pt_b, mask=None):
47# args = [pt_a._vec, pt_b._vec, mask] if mask else [pt_a._vec, pt_b._vec]
48# #TODO: access to protected member
49# return self._wld.ray_test_all(*args)
8ee66edd 50
cb700bcc
FC
51# def toggle_dbg(self):
52# hidden = self.__debug_np.is_hidden()
53# (self.__debug_np.show if hidden else self.__debug_np.hide)()
8ee66edd
FC
54
55
cb700bcc 56# class BulletTriangleMesh:
8ee66edd 57
cb700bcc
FC
58# def __init__(self):
59# self._mesh = BTriangleMesh()
8ee66edd 60
cb700bcc
FC
61# def add_geom(self, geom, rm_dupl, xform):
62# return self._mesh.add_geom(geom, rm_dupl, xform)
8ee66edd
FC
63
64
cb700bcc 65# class BulletTriangleMeshShape:
8ee66edd 66
cb700bcc
FC
67# def __init__(self, mesh, dynamic):
68# self._mesh_shape = BTriangleMeshShape(mesh._mesh, dynamic=dynamic)
69# #TODO: access to protected member
8ee66edd
FC
70
71
cb700bcc 72# class BulletRigidBodyNode:
8ee66edd 73
cb700bcc 74# def __init__(self, name): self._node = BRigidBodyNode(name)
8ee66edd
FC
75
76
cb700bcc 77# class BulletGhostNode:
8ee66edd 78
cb700bcc 79# def __init__(self, name): self._node = BGhostNode(name)