cs381/as6/components/GravityWellComponent.hpp

45 lines
1.1 KiB
C++

#pragma once
#include "Component.hpp"
/**
* Represents player-controlled gravity source that follows mouse input.
*/
struct GravityWellComponent : public Component {
/**
* Mass of the gravity well, affecting the strength of the gravitational pull on receivers.
*/
float mass = 150000.0f;
/**
* Minimum distance for gravity pull calculations to avoid singularities and excessive forces
* when very close to receivers.
*/
float minDist = 30.0f;
/**
* Whether the gravity well is currently active and should apply gravitational forces to
* receivers (e.g. tied to mouse button state).
*/
bool active = false;
/**
* If true, active state is driven by left mouse button and this well follows the cursor.
*/
bool controlledByMouse = true;
/**
* If true and not mouse-controlled, this well applies gravity every frame.
*/
bool alwaysActive = false;
/**
* Lerp factor for how quickly the gravity well follows the mouse position.
*/
float followLerp = 12.0f;
void Setup() override;
void Update(float dt) override;
void Cleanup() override;
};