def CheckTrigger(self): if not self.triggered: if not self.trigger: self.triggered = True else: position = MiroAPI.GetBodyPosition(self.GetBody()) velocity = MiroAPI.GetBodyVelocity(self.GetBody()) acceleration = MiroAPI.GetBodyAcceleration(self.GetBody()) if self.trigger(position, velocity, acceleration): self.triggered = True self.F = MiroAPI.AddBodyForce(self.GetBody(), self.force, [0, 1, 0], new=True) elif self.fuel > 0: MiroAPI.AddBodyForce(self.GetBody(), self.force, [0, 1, 0], new=False) self.fuel = self.fuel - self.cons * self.dt elif not self.expended: MiroAPI.RemoveBodyForce(self.GetBody(), self.F) self.expended = True
def LogData(self): if (self.logging): vel = MiroAPI.GetBodyVelocity(self.GetBody()) data = str(vel[0]) + ' ' + str(vel[1]) + ' ' + str(vel[2]) + '\n' self.filestream.write(data)
def GetVelocity(self): return MiroAPI.GetBodyVelocity(self.body)