2024-12-22 10:22:32 +01:00

41 lines
946 B
Python

from .Spherical import Spherical
from .Quaternion import Quaternion
class Thing:
allThings = set()
Position = 0x01
Orientation = 0x02
LinearVelocity = 0x04
AngularVelocity = 0x08
def __init__(self):
self.networkId = 0
self.id = 0
self.type = 0
self.parent_id = 0
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)