#### Archived

This topic is now archived and is closed to further replies.

# 2D Physics (On lines)

This topic is 5675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
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

1. 1
2. 2
frob
20
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632213
• Total Posts
3004843

×