Skip to main content
gamedev.net
🔒 Locked

Force - Object

Started by VanKurt 14 replies 1.4k views
Original Post
VanKurt
VanKurt
Hi there! I'm having a little problem with creating a little physics (2D) sim. Imagine there is an object consisting of several vertices, line segments that connect tose vertices (a hull) and a center of mass. Now because of a collision (or whatever) there is a point on the object's hull, from which a force (a 2D vector) shall be applied. What's the right way to do this? Simply add the force to every vertex' force variable? Actually the whole thing must somehow be weighted: vertices closer to the center of mass get less force, and vertices on the opposing side of the CM have to be moved in the reverse direction (so that the object starts to spin, if it is hit at one edge)...do you know what I mean? It's hard to explain ;-) What's the right approach for this? Thanks for your help!
Eelco
Eelco
the best advice i can give you at this moment is to tell you youre totally on the wrong track.

find yourself some introductory information on rigid body simulation, either from the internet, which has plenty of decent sources on the subject, or you could pick up a book.

Eelco
Eelco
the best advice i can give you at this moment is to tell you youre totally on the wrong track.

find yourself some introductory information on rigid body simulation, either from the internet, which has plenty of decent sources on the subject, or you could pick up a book.

ajas95
ajas95
You need to have an angular velocity also to your shape. This is not exact but will give you the behavior you're looking for and is fairly straightforward. When you apply the velocity of the object to the vertices, you also rotate all the vertices around the center of mass by the angular velocity.

To figure out the angular velocity that a force imposes, first, imagine a circle centered on the center of mass and passing through the contact point. You can break the force at the contact point into 2 perpendicular components: one that points directly at the center of mass, and the other which is tangental to the circle. The force toward the center is translational force (which applies to all vertices the same), and the tangental force causes the shape to start spinning.

Now, F = ma, and angular acceleration (alpha) = a/r, so
F = mr * alpha, so
alpha = F/mr

so if you take the tangental component of force and divide it by the mass times the distance from the CoM of the contact point, you have an angular acceleration, which you can apply to angular velocity just like linear acceleration works with linear velocity.

I should point out that this approach simplifies a bunch of things involving inertia which would otherwise be much more complicated.
VanKurt
VanKurt
"totally on the wrong track" ??? Ooops!
I thought that was the was the rigid bodies worked...I must have gotten something wrong ;-)

Thanks for your replies!
Squirm
Squirm
Aww, be nice, not totally the wrong track, just for a rigid body don't apply things to vertices - apply them to the body. That's one force and one velocity (and one torque and one angular velocity).

google "Chris Hecker Physics"
Jiia
Jiia
Actually, I liked the first idea very much [smile]

It would be very cool to apply that to a soft object. Use springs between vertices, but retain the mass as the object changes shape. Like jellow bouncing [lol]
Eelco
Eelco
Quote:
Original post by Jiia
Actually, I liked the first idea very much [smile]

It would be very cool to apply that to a soft object. Use springs between vertices, but retain the mass as the object changes shape. Like jellow bouncing [lol]

its called a verlet mass spring system...
Jiia
Jiia
Quote:
Original post by Eelco
its called a verlet mass spring system...

Damn, I liked Jello better [wink]
ajas95
ajas95
What's really funny about that name is that Verlet integration has nothing to do with the mass-spring systems that Jakobsen wrote about in Advanced Character Physics (the paper that everyone knows this technique by). You can apply verlet integration to many other fixed-timestep problems, and you can simulate the mass-spring systems any way choose.

It's totally arbitrary. It's like calling something a "butter-knife muffin" just because you used a butter-knife to spread the jelly.
VanKurt
VanKurt
I've put together a little (crappy) app: www.vankurt.de/files/RigidShit.zip

Is this a rigid body simulation? As you might notice: I haven't got the slightest clue ;-)
And why does that damn thing NEVER come to rest?

Argh, that's more diffucult than I had imagined.... :-(
Eelco
Eelco
Quote:
Original post by ajas95
What's really funny about that name is that Verlet integration has nothing to do with the mass-spring systems that Jakobsen wrote about in Advanced Character Physics (the paper that everyone knows this technique by). You can apply verlet integration to many other fixed-timestep problems, and you can simulate the mass-spring systems any way choose.

It's totally arbitrary. It's like calling something a "butter-knife muffin" just because you used a butter-knife to spread the jelly.

true. i considered being a little more technical, but then again that wouldnt have helped him in his searches.
no_skill
no_skill
Quote:
Original post by Eelco
the best advice i can give you at this moment is to tell you youre totally on the wrong track.

find yourself some introductory information on rigid body simulation, either from the internet, which has plenty of decent sources on the subject, or you could pick up a book.


are there some standard books on game collision detection/physics or books you`d suggest?
VanKurt
VanKurt
*bump*
oliii
oliii
there hasn't been an exhaustive, all-knowing physics books for games just yet. The best I can recommend is Dave Eberly's "Game Physics" books, but that's for like designing a physics engine, so it's not an easy read, and not 100 complete (especially on the collision detection side).

for that, you can have a look at

"Collision Detection in Interactive 3D Environments" - Gino van den Bergen.

The guy who design the SOLID collision detection library, based on the GJK algorithm. I haven;t read the book though, but he sure knows a lot about CD. Quite advanced probably. May be it's also quite narrow in its scope, but I could be wrong.


"Physics for Game Developers" - David M Bourg

More like an introduction to physics, and has some useful case studies. If you've never done physics before, that would be a good introduction book.

So all in all, in my opinion, there is not one single book that covers everything required to design an all-purpose physics engine, and also relates to the more obsure methods that can be used (BSP trees, voxels, deformable scenery, ect...). But that book would have to be 1000s of pages thick :)

For all of these, you still need to have at least some basic knowledge of linear algebra, geometry, trigonometry, and the likes... Physics is math-heavy.

BTW, head to the book section here...

http://www.gamedev.net/columns/books/books.asp?CategoryID=13
Everything is better with Metal.
Airo
Airo
I'm waiting for Christer Ericsson (SP?) - Real-time collision detection book. The content looked really good. I'm not sure how this book compares to the one from Gino van den Bergen.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.