I'm really excited to get started on programming my very first physics simulation.
Right now collisions look like this:
[media]
[/media]
As you can see i can find the point of intersection for edges vs points but for edge vs edge the function i use to get point of intersection returns an ambiguous point (im not sure if the video shows that but just trust me it does).
So anyway i was reading this guys Article (PART 3) on collision detection and it turns out that i need to have a center of gravity for each shape and a vector that points from the center of gravity to the point of intersection and somehow you can get a normal. The thing is, i dont even understand where the normal comes from.
The diagram in the article looks much like this:
Can someone explain to me how i get the normal?
I'm self taught and dont fully grasp the math used in these papers..
Also i'm not using matrix math to rotate the polygons because im having trouble applying matrix math to programming.
I've decided im going to rotate shapes the retarded way by storing a copy of the shape and individually change the angle of each vertex.
using:
x=distance*cos(angle + newangle) + center.X
y=distance*sin(angle + newangle)+center.Y
***********************************UPDATE***************************************
Ok I have a new problem/
For a while now , i've been updating positions of shapes by scaling my velocity vector down by a certain magnitude and then adding the vector that i scaled down with the translation vector, updating my position.
This seemed to give me decent sliding effects and the appearance of arcade physics.
to give you a better idea of how I update positions here's an example of an update function:
void UpdatePositions(){
Vector2D velocity = getCurrentVelocity() ;
Vector2D TranslationVector = getTranslationVector();//<- Vector that translates all the points that belong to the shape
Velocity *= 0.9;//<-Scaling the magnitude of the velocity vector down every frame
TranslationVector +=Velocity; //<-Updating position of polygon based on velocity vector
}
Up until my recent project to implement a rigid body system, this seemed to work fairly well for arcade physics.
Recently ,I've learnt that i should use something called "integration".
I looked it up on Wikipedia and youtube for more information and i was completely blown away at how difficult it looked to use integration with ANYTHING.
I have no experience with calculus and absolutely no experience with integration.
In order to add rotation to polygons, Do i NEED to learn things like:
-> verlet intergration
->Runge Kutta intergration
->euler Intergration
(sorry if i spelled them wrong)
the only tools i have (regarding math skills) to tackle this is everything I learnt in grade 11 advanced functions.
I've also taught myself vector operations but those arent too difficult to understand.
An example of how objects should rotate when im finished:
[media]
[/media]