from .Spherical import Spherical from .Quaternion import Quaternion class Thing: allThings = set() Position = 0x01 Orientation = 0x02 LinearVelocity = 0x04 AngularVelocity = 0x08 def __init__(self, parent=None): self.networkId = 0 self.id = 0 self.type = 0 if parent is None: self.parent_id = 0 else: self.parent_id = parent.id self.name = None self.model_url = None self.position = Spherical.zero self.orientation = Quaternion.identity self.linearVelocity = Spherical.zero self.angularVelocity = Spherical.zero self.pose_updated = 0x00 # the bits indicate which fields have been updated Thing.Add(self) def update(self, currentTime): pass @staticmethod def Add(thing): thing.id = len(Thing.allThings) Thing.allThings.add(thing) def UpdateAll(currentTime): for thing in Thing.allThings: thing.update(currentTime)