Repelling Force ?

Started by
2 comments, last by Endemoniada 20 years, 2 months ago
Hi guys, I''m trying to make a robust repelling force in my dodgeball-like game. I apply the force in the direction from the force point to the object, which causes acceleration in that direction; pretty basic stuff. It doesn''t work that great though. If the moving object is approaching it slowly it bounces off like it hit an invisible rubber bumper, and if it''s moving quickly it can pass right though. If I apply less force (acceleration) the slow objects repell nicely but the fast objects aren''t really affected, and if I apply a stronger force to repell the faster objects the slower ones bounce off abruptly. Maybe I should apply a force proportional to the incoming velocity of the object ? Then would it matter if the object is heading towards or away from the force ? I experimented a lot and can''t get it right. Any ideas ? Thanks.
Advertisement
Tou could make the force dependent on distance, like 1/x or something.
Sounds like what your talking about is elastic collisions.

Basically, the object which is travelling along...has a certain amount of energy ( Im sure you know this already. Its probably me just wanting to explain things ). When it hits something, the collision is gonna decrease the ammount of energy it has right?

When the object hits something, most of its kenetic energy goes into deforming its shape ( the squish ) and is stored up, kinda like stretching an elastic band. There is a little bit of energy however lost through sound and heat ( this is important ). When the object is no longer moving, the energy it has stored up by changing shape is then converted back into kenetic energy (let go of said elastic band), in the direction off the wall it hit for example, and it flies off to have more bouncing fun.

Its the energy thats lost, that makes the object bounce less and less the more collisions it has.

Er.........Yea :D

Hope that helped a little.
You can try reflecting the velocity about the normal of the surface that it is hitting.

This topic is closed to new replies.

Advertisement