2D Physics (On lines)

Started by
0 comments, last by allsorts46 21 years, 2 months ago
I have been trying to implement some basic physics on some 2D lines, but since I''ve got no real idea how, I''ve had to come up with some things... what do you think about this method?

A--------------B

   /\
  /  \
 /    \
I apply gravity to the line by giving each end of it a speed and direction. To start with this would be equal both ends, and downwards. When the line hits the triangle, I would detect the colision. The idea I came up with to deal with the reaction is this: Give the line a value of 2. Work out the length from point A to collision point (lA) and from point B to collision point (lB). Using a simple formula (to tired to think of it now, but I know its no problem) I divide the value of the line (2) to the ratio of the distances. ie if the colision point was exactly between A and B, mA and mB (multiplyers) would both be 1. I then multiply these multiplyers by the forces on the points, so fA = fA * mA, and fB = fB * mB. Right, now make a big circle, which centres between A and B, and passes through both points. Take away force B from force A (Ok I''m losing it now I have no idea what I''m on about lol), I assume I''d subtract vectors? THEN... Work out where the point with the largest force would end up after the force (vector) was applied. And then work out the closest point on the circle to the new position. Then find out how many degrees round this is from the starting point, then apply the same rotation to the other point. Wow. lol. Now I think about it that sounds massivle overcomplicated, but it looked good on paper. Anyway, am I even close to being on the right lines? Would that work? Also, I want to deal with joints. like a line broken in two peices. Plus my method wont let things slide down slopes etc, which would be nice. So.. any help appreciated, I am clearly crazy. Warning in life.cpp (8): const Happiness is declared but never used.
"The finger of blame has turned upon itself"
Advertisement
you should just read up on rotational inertia, moments of inertia, conservation of momentum and whatnot. basically just get a standard physics textbook and read it. what you are trying to do has already been solved out and had all the equations of calculation found for it. it''ll be easier to not have to try and re-invent physics...

-me

This topic is closed to new replies.

Advertisement