the collision is basically what I'm working on.
ive looked all over google but i can't find anything that really helps me, or at least i don't understand most of it.
in my object class i have
Rect rect; // The rectangle I am drawing and checking collision with
Vector2 pos;
Vector2 velocity;
Vector2 acceleration;
Vector2 momentum; // I can't remember if this is supposed to be a vector or a number lol
float mass;
// I know how to calculate the momentum
momentum = mass * velocity;
void CheckCollision(Object *Other)
{
float dt = time.GetDeltaTime();
RECT colRect;
// Check for a collision
if(IntersectRect(&colRect,&rect,&Other->rect))
{
// There was a collision, now lets do physics
// Calculate the force first? And im not sure if I'm doing this correctly, cause you can't multiply a vector by another vector
Vector2 myForce = mass * momentum * velocity;
Vector2 otherForce = Other->mass * Other->momentum * Other->velocity;
// I'm not sure if i know how to calculate the impulse either, this is from what I remember + what I gathered online that i couldn't really understand
Vector2 impulse = myForce-otherForce * dt;
}
}
// I just want to do the collision with physics without anything else involved like: Friction,Gravity, Air Resistance or what have you.
// Do I need to use the Coefficient of Restitution? and if so what exactly is that and how do I calculate it?






