How to handle multiple simultaneous elastic collisions?

前端 未结 3 2160
陌清茗
陌清茗 2021-02-09 07:20

I\'m computing the result by colliding pairs of 2D convex objects (without rotation), using the basic equations on wikipedia. However, when there are dependencies, like two obj

3条回答
  •  没有蜡笔的小新
    2021-02-09 08:04

    Do the individual collisions one-by-one, but always use the initial velocity of each object. When done, add up the velocity-changes for each object.

    (v1_1,v3_1) = collide(u1,u3,m1,m3)
    (v2_2,v3_2) = collide(u2,u3,m2,m3)
    v1 = u1 + (v1_1 - u1) = v1_1
    v2 = u2 + (v2_2 - u2) = u2_2
    v3 = u3 + (v3_1 - u3) + (v3_2 - u3) = v3_1 + v3_2 - u3
    

    This way, it will not be order-sensitive.

提交回复
热议问题