[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 169 KB, 1280x751, ScreenSHot1.png [View same] [iqdb] [saucenao] [google]
2635637 No.2635637 [Reply] [Original]

So. For this game how would I calculate force of collision between two objects?
Its programmed in XNA, i can grab their velocity as a float or directional velocity as a vector2. Every object also have a mass.

We tried the following equation
Vector2 KineticEnergy1 = objectone's mass * objone's velocity^2
KineticEnergy2 = objectwo's mass * objtwo's velcity^2
result = KE1 + KE2

collisonEnergy = Abs((Ke1 - result) - (Ke2 - result))

>> No.2635643

Shameless bump

>> No.2635654

maybe you could make their velocity the damage.

>> No.2635655

Did you try momentum?
http://en.wikipedia.org/wiki/Collision
Are they elastic collisions?

>>2635643
Can you not bump every 2 minutes in the future?

>> No.2635657

The elasticity of collision is .3

>> No.2635666

>>2635657
http://en.wikipedia.org/wiki/Inelastic_collision

Use that big equation. Problem solved.

>> No.2635717

Sorry, i'm looking for the force of impact, not velocity exiting/entering

>> No.2635727
File: 36 KB, 450x331, cutecraftdog.jpg [View same] [iqdb] [saucenao] [google]
2635727

This video should explain everything

http://www.youtube.com/watch?v=YYVXywz_7ck&feature=related

>> No.2635730

bump

>> No.2635731

>>2635637
of course, i forgot the apply the nyan variable to the equation

>> No.2635734

>>2635637
>>KineticEnergy1 = objectone's mass * objone's velocity^2
>>KineticEnergy2 = objectwo's mass * objtwo's velcity^2
>>result = KE1 + KE2
I think I see the problem. This will only work properly if the vectors of the two object's velocities are exact opposites when they crash. It is possible for two objects to be going really fast relative to the background, but relative to each other much slower because they are both going in roughly the same direction.

Use this:
result = objectone's mass * objectwo's mass * (objone's velocity - objtwo's velcity) ^2

>> No.2635743

it seems like the crashes and force reading is a lot more stable now. Thanks.