DistributedNode.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """DistributedNode module: contains the DistributedNode class"""
  2. from ShowBaseGlobal import *
  3. import NodePath
  4. import DistributedObject
  5. class DistributedNode(DistributedObject.DistributedObject, NodePath.NodePath):
  6. """Distributed Node class:"""
  7. def __init__(self, cr):
  8. try:
  9. self.DistributedNode_initialized
  10. except:
  11. self.DistributedNode_initialized = 1
  12. DistributedObject.DistributedObject.__init__(self, cr)
  13. return None
  14. def disable(self):
  15. self.reparentTo(hidden)
  16. DistributedObject.DistributedObject.disable(self)
  17. def delete(self):
  18. self.reparentTo(hidden)
  19. DistributedObject.DistributedObject.delete(self)
  20. def d_setPos(self, x, y, z):
  21. self.sendUpdate("setPos", [x, y, z])
  22. def d_setHpr(self, h, p, r):
  23. self.sendUpdate("setHpr", [h, p, r])
  24. def d_broadcastPosHpr(self):
  25. self.d_setPosHpr(self.getX(), self.getY(), self.getZ(),
  26. self.getH(), self.getP(), self.getR())
  27. def d_setPosHpr(self, x, y, z, h, p, r):
  28. self.sendUpdate("setPosHpr", [x, y, z, h, p, r])