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 Initialize(self, output_file_name, MiroSystem): super().Initialize(output_file_name, MiroSystem) self.start = MiroAPI.GetBodyPosition(self.GetBody())
def LogData(self): if (self.logging): pos = MiroAPI.GetBodyPosition(self.GetBody()) - self.start data = str(pos[0]) + ' ' + str(pos[1]) + ' ' + str(pos[2]) + '\n' self.filestream.write(data)
def GetPosition(self): return MiroAPI.GetBodyPosition(self.body)