def __init__(self, name: str, force: Vector2d, trigger_object_density: float, trigger_object: BaseNonStaticObject, force_direction: Vector2d, targeted_objects: List[BaseNonStaticObject]) -> None: """ Parameters: name (str): name of the force force (Vector2d): force that will applied to the objects rest_length (float): length of a spring in rest state trigger_object (BaseNonStaticObject): object that will trigger force generator if targets collide with the object trigger_object_density (float): density of a pure water is 1000 kg per cubic meter targeted_objects (List[BaseNonStaticObject]): objects on which the force will be applied all static objects will be omitted duration (float): the time that a force will be active """ super().__init__(name, force, targeted_objects) self.trigger_object = trigger_object self.trigger_object_density = trigger_object_density self.force_direction = force_direction.normalize()
def get_support_point(self, direction: Vector2d): direction = direction.normalize() direction = direction.scale(self.radius) point = self.center + direction return point