Archived

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

physics for a 2d square in a 3d world

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

Recommended Posts

Hi, im just working on the physics for a 2d face in a 3d world. What i mean, is that suppose i have a large flat piece of wood in my 3d world. I drop this piece of wood from the top of a building and it falls to the ground. If part of the wood hits something on the way down, then this causes it to spin or staggers that part of the wood so that it is no longer parallel with the ground.

wood    -----------

|
gravity      |    --------
|    |
\_/   |     obsticle
|
|
|

ground ------------------------


clearly we can see that once the wood hits the obsticle, it will no longer be parallel with the ground. So far i have represened the wood with 4 points (one for each corner) Each point has mass, velocity, and other parameters. The problem is how to maintain the distance relationship among the nodes of the wood. I can easily determin the edge of the polyogn of the obsticle that the object will topple over, so thats a start to determining the pivot of the wood once it hits the obsticle. Also,are there any articles that deal with this implementation? Thanks [edited by - _walrus on May 29, 2002 3:40:47 PM] [edited by - _walrus on May 29, 2002 3:44:47 PM]

Share on other sites
i think u have to find the forces that are on each corner.
Calculate whatz the result force (a value and a direction) on the wood. Then you have to rotate the polygon at that direction / "speed". Don''t stop turning it unless it hits again: Calculate a new result force and add to the old one (vector).
it should works..

Share on other sites
Following your description I''m assuming that you''re happy to ignore the wood''s wind resistence and that the wood is not going to be in a position where its center of mass is directly above an obstacle and would be stopped. I''m also assuming that the sliding of the wood over the edge of an object is negligible, and that it is flat when it hits the first object.

When you drop the wood at a time t=0 it''s velocity at later times is given by v = 0.5 * g * t2 where g is the acceleration due to the earth''s gravity and is about 9.8 m/s2

When the wood hits something you can approximate the rate at which it will start spinning very well by doing this:

Find the distance r to the part of the wood that is furthest from the line made by the edge of the obstacle. The rate at which the wood rotates around the edge of the object (the angular velocity) is given by w = v/r.

Next time you update the wood''s position reset it''s downward velocity to 0, and start rotating it around the edge of the obstacle with the angular velocity above. e.g. if you step through your loop corresponding to a timestep of DT, then rotate the wood by DT*w about the obstacle''s edge.

When the wood rotates past the vertical, which occurs n steps later for the first n that n * DT * w > 90 degrees start accelerating it downwards again and keep it spinning.

That should get you started for more complicated situations.

Share on other sites
Thanks for the replies, there quite helpful. To elaborate on what i'm trying to do, is this a descent solution?:

I am actually acounting for wind resistance and center of mass. I currently have a pretty good physics model for single point based entities. These point based entities account for wind resistance, bounce, and Mass. I want to be able to use serveral of these point based entities to create a more complex object, such as a polygon(the wood). I was thinking when i started implementation to have center of mass as follows:
   - get the points that are not at rest   - get the points that are at rest    - if the sum of the forces due to gravity from the points at rest is greater than the sum of the forces due to gravity from the points not at rest then the object will land on this face, otherwise it will topple over the face.dont topple since the force at the right node is greater than the force at left node:   Force  3           8   wood    ------------              ----------------              |              |              |Topple since force is greater on the left than right:   Force  3           1   wood    ------------              ----------------              |              |              |   Ofcouse this doesnt handle our wood is straddling the obstruction:     force     3                    3     wood      ----------------------                                          ----------                    |obsticle|                    |        |

Wind resistance is maintained by the individual points on the the wood (corners), so i should beable to make something rotate as it falls if the wind resistance is greater at one of the corner nodes.

[edited by - _walrus on May 29, 2002 6:58:21 PM]

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 10
• 27
• 20
• 9
• 20
• Forum Statistics

• Total Topics
633402
• Total Posts
3011670
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!