I created a bounce simulation using exactly the formula from Wikipedia. The behavior I observe is not what I would expect in two cases:
When two balls hit off-centre, they act the same as if the impact was face-on.
Click for animationWhen a small ball hits big ball (with gravity), it bounces back and forth in arc, not around the big ball: animation.
Is this behavior consistent with the inelastic equation formula?
Answer
For a 2D planar simulation with zero friction do the following
Definitions
- Each body has 3 degrees of freedom. These are (x1,y1,θ1) and (x2,y2,θ2) defined at the center of mass.
- Each body has mass and mass moment of inertia. These are m1, m2 and Iz1, Iz2.
- The contact is at point A with coordinates (xA,yA) and with normal direction from the angle ψ (measured CCW from +x).
- The coefficient of restitution is ϵ
Representation
- The velocity of each body before the impact is defined with a 3×1 vector (in planar screw coordinates at the origin) v1=(˙x1+˙θ1y1˙y1−˙θ1x1˙θ1)v2=(˙x2+˙θ2y2˙y2−˙θ2x2˙θ2)
The contact normal (force) direction is n=(cosψsinψxAsinψ−yAcosψ)
Note that the velocity of body 1 on the contact point, along the contact normal is found by n⋅v1=n⊤v1=(˙x1+˙θ1(y1−yA))cosψ+(˙y1−˙θ1(x1−xA))sinψThe inverse inertia matrix for each body is
I−11=|1m1+y21Iz1−x1y1Iz1y1Iz1−x1y1Iz11m1+x21Iz1−x1Iz1y1Iz1−x1Iz11Iz1|I−12=|1m2+y22Iz2−x2y2Iz2y2Iz2−x2y2Iz21m2+x22Iz2−x2Iz2y2Iz2−x2Iz21Iz2|
Elastic Impact
The impact velocity (scalar) is vimp=−n⊤(v2−v1)
The inverse effective mass (scalar) along the contact of each body is μ−11=n⊤I−11nμ−12=n⊤I−12n
The impulse acting on body 2 is J=(1+ϵ)vimpμ−11+μ−12
The impact J acting along n changes the motion of each body by Δv1=−I−11nJΔv2=I−12nJ
The changes in motion are transferred back to the center of mass (change in) velocities Δ˙x1, Δ˙y1 and change in spin Δ˙θ1 by solving the following definition
Δv1=(Δ˙x1+Δ˙θ1y1Δ˙y1−Δ˙θ1x1Δ˙θ1)Δv2=(Δ˙x2+Δ˙θ2y2Δ˙y2−Δ˙θ2x2Δ˙θ2)
Impact Step
- The final velocity at the center of mass is changed from the step values
˙x1←˙x1+Δ˙x1˙x2←˙x2+Δ˙x2˙y1←˙y1+Δ˙y1˙y2←˙y2+Δ˙y2˙θ1←˙θ1+Δ˙θ1˙θ2←˙θ2+Δ˙θ2
No comments:
Post a Comment