#should i make separate class for the physics and the object ?

11 messages · Page 1 of 1 (latest)

valid jewel
#

**`class Physics
{
public:
Physics();

void ApplyGravity();

void SetDeltaTime(float deltaTime) { this->DeltaTime = deltaTime; }
void SetMass(double mass) { this->Mass = mass; }
void SetVelocity(float Velcity) { this->Velocity = Velocity; }
void SetAcceleration(float Acceleration) { this->Acceleration = Acceleration; }

double GetMass() const { return Mass; }
float GetPosX() const { return posX; }
float GetPosY() const { return posY; }
float GetVelocityX() const { return velX; }
float GetVelocityY() const { return velY; }

private:

const double EarthgForce = 9.81;
double gForce, Gforce;

float posX, posY;
float velX, velY;

float Velocity, Acceleration;
float DeltaTime;

double Mass;

};`**

brazen anchorBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

valid jewel
#

sp here i have a physics and object class

#

and for example i have the ApplyGravity() function, should i separate the class to physics and class for the object itself ? and it will be for example ApplyGravity(Object& Entity)

#

or should i make this

class Object : Physics
{

}

and it will be the physics class but object

ivory timber
#

Physics shouldn't be a class

#

it should be a namespace

#

And yes you should be separating physics and objects

#

it's weird that I can SetDeltaTime of some object
and also GetMass of physics

valid jewel
valid jewel
#

!solved