5 #define _USE_MATH_DEFINES 20 const double DOWN = M_PI * 0.5;
24 const double UP = M_PI * 1.5;
42 Physics(
Object *parent =
nullptr, std::string name =
"Physics");
59 Physics(
double strength,
double direction,
double drag,
Object *parent =
nullptr, std::string name =
"Physics");
131 Rigidbody(
double mass,
Object *parent =
nullptr, std::string name =
"Rigidbody");
168 void SetVelocity(
double strength,
double direction);
239 Collider(
Object *parent =
nullptr, std::string name =
"Collider");
341 AABBCollider(
double width,
double height,
Object *parent =
nullptr, std::string name =
"AABBCollider");
373 void SetSize(
double width,
double height);
double _accelerationDirection
Direction of acceleration.
Definition: Physics.hpp:115
std::pair< Collision, Collision > TestCollision(Collider *other)
Finds if there is a collision between this Collider and another Collider.
double GetVelocityDirection()
Gets the current velocity direction.
void SetHeight(double height)
Sets the height.
Physics class.
Definition: Physics.hpp:28
const double UP
Up.
Definition: Physics.hpp:24
AABBCollider BoxCollider
BoxCollider is a synonym to AABBCollider.
Definition: Physics.hpp:380
double _gravityScale
Amount gravity affects this object.
Definition: Physics.hpp:117
void SetVelocity(double strength, double direction)
Sets the velocity.
void SetGravityStrength(double strength)
Sets the gravity strength.
void SetAccelerationDirection(double direction)
Sets the acceleration direction.
double _width
Width of the box.
Definition: Physics.hpp:324
double _mass
Mass of the object.
Definition: Physics.hpp:107
Object(Object *parent=nullptr, std::string name="Object")
Constructor Derived classes should call this in their constructors' initialization list.
const double DOWN
Down.
Definition: Physics.hpp:20
Rigidbody class.
Definition: Physics.hpp:104
double _radius
Radius of the collider.
Definition: Physics.hpp:277
General base class Allows for parent/child relationship trees.
Definition: Object.hpp:33
double GetAccelerationY()
Gets the current vertical cartesian acceleration strength.
double GetGravityScale()
Sets the object's gravity scale.
void SetCartesianVelocity(double x, double y)
Sets the velocity strength and direction via cartesian coordinates.
void ApplyCartesianForce(double x, double y)
Applies a cartesian force to the Rigidbody.
bool _trigger
Determines if the collider is a trigger or solid object.
Definition: Physics.hpp:229
CircleCollider(Object *parent=nullptr, std::string name="CircleCollider")
Constructor.
double _height
Height of the box.
Definition: Physics.hpp:326
double _velocityDirection
Direction of velocity.
Definition: Physics.hpp:111
Collider(Object *parent=nullptr, std::string name="Collider")
Constructor Derived classes should call this in their constructors' initialization list.
double GetGravityStrength()
Gets the current gravity strength.
double GetAccelerationStrength()
Gets the current acceleration strength.
void SetGravityDirection(double direction)
Sets the gravity direction.
void SetGravityScale(double scale)
Sets the object's gravity scale.
double GetMass()
Gets the object's mass.
void PopulateDebugger()
Fills out the Debugger if it exists with this Object's information Derived classes should call their ...
void SetDrag(double drag)
Sets the drag factor.
bool InCollider(int x, int y)
Determines if a point is within the collider.
double GetVelocityY()
Gets the current vertical cartesian velocity strength.
void operator()()
Updates this object and all of its children Derived classes should call or reimplement this at some p...
Collider class.
Definition: Physics.hpp:225
std::pair< Collision, Collision > TestCollision(Collider *other)
Finds if there is a collision between this Collider and another Collider.
Axis Aligned Bounding Box Collider class.
Definition: Physics.hpp:321
void PopulateDebugger()
Fills out the Debugger if it exists with this Object's information Derived classes should call their ...
double GetGravityX()
Gets the current horizontal cartesian gravity strength.
void SetMass(double mass)
Sets the object's mass.
void operator()()
Updates this object and all of its children Derived classes should call or reimplement this at some p...
void ApplyForce(double force, double angle)
Applies a force to the Rigidbody.
Rigidbody(Object *parent=nullptr, std::string name="Rigidbody")
Constructor.
double _accelerationStrength
Strength of acceleration.
Definition: Physics.hpp:113
void SetVelocityStrength(double strength)
Sets the velocity strength.
double _gravDirection
Gravity direction.
Definition: Physics.hpp:33
void ResolveCollision(Collision collision)
Resolves a collision and passes the collision to the parent via OnCollision.
void SetRadius(double radius)
Sets the radius.
virtual bool InCollider(int x, int y)
Determines if a point is within the collider.
virtual std::pair< Collision, Collision > TestCollision(Collider *other)
Finds if there is a collision between this Collider and another Collider.
AABBCollider(Object *parent=nullptr, std::string name="AABBCollider")
Constructor.
const double RIGHT
Right.
Definition: Physics.hpp:22
double GetGravityDirection()
Gets the current gravity direction.
void ResolveCollision(Collision collision)
Resolves a collision and passes the collision to the parent via OnCollision.
void SetSize(double width, double height)
Sets the box's size.
void SetGravity(double x, double y)
Sets the gravity strength and direction via cartesian coordinates.
void SetTrigger(bool trigger)
Determines if the collider is a trigger or solid object.
void PopulateDebugger()
Fills out the Debugger if it exists with this Object's information Derived classes should call their ...
const double LEFT
Left.
Definition: Physics.hpp:18
double GetVelocityStrength()
Gets the current velocity strength.
Collision class.
Definition: Collision.hpp:25
CircleCollider class.
Definition: Physics.hpp:274
double GetRadius()
Gets the radius.
virtual void ResolveCollision(Collision collision)
Resolves a collision and passes the collision to the parent via OnCollision.
void SetAccelerationStrength(double strength)
Sets the acceleration strength.
void SetWidth(double width)
Sets the width.
double GetGravityY()
Gets the current vertical cartesian gravity strength.
void operator()()
Updates this object and all of its children Derived classes should call or reimplement this at some p...
double _drag
Drag factor.
Definition: Physics.hpp:35
bool _mouseOver
Determines if the collider is being moused over.
Definition: Physics.hpp:231
double GetHeight()
Gets the height.
Physics(Object *parent=nullptr, std::string name="Physics")
Constructor.
double GetAccelerationX()
Gets the current horizontal cartesian acceleration strength.
Aspen engine namespace.
Definition: Audio.hpp:8
double GetDrag()
Gets the current drag factor.
double GetAccelerationDirection()
Gets the current acceleration direction.
double GetWidth()
Gets the width.
double _gravStrength
Gravity strength.
Definition: Physics.hpp:31
void SetCartesianAcceleration(double x, double y)
Sets the acceleration strength and direction via cartesian coordinates.
bool IsTrigger()
Determines if the collider is a trigger or solid object.
void SetAcceleration(double strength, double direction)
Sets the acceleration.
double GetVelocityX()
Gets the current horizontal cartesian velocity strength.
void SetVelocityDirection(double direction)
Sets the velocity direction.
bool InCollider(int x, int y)
Determines if a point is within the collider.
void PopulateDebugger()
Fills out the Debugger if it exists with this Object's information Derived classes should call their ...
double _velocityStrength
Strength of velocity.
Definition: Physics.hpp:109
void PopulateDebugger()
Fills out the Debugger if it exists with this Object's information Derived classes should call their ...