0
\$\begingroup\$

I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle.

Physics paramaters:

Player Physics : 
    radius : 15,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass : 2
    damping : 0.96101


Ball Physics :
    radius : 8,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass: 1,
    damping : 0.9902

Gif image(angled): haxball gif angled

Player speed on start: Vx: 5, Vy: 0

Ball speed on start: Vx: 0, Vy: 0


Player speed on collision: Vx: 3.4189778846153844, Vy: -0.9240480769230772

Ball speed on collision: Vx: 2.7721442307692317, Vy: 1.8480961538461544

The formula i use(this formula can calculate the speed when there is no angle): Formula image: Formula image

V1 = (m1*u1*k1 + m2*u2*k2 + m2*C1*C2*(u2*k2 - u1*k1)) /(m1 + m2)
V2 = (m1*u1*k1 + m2*u2*k2 + m1*C1*C2*(u1*k1 - u2*k2)) /(m1 + m2)

C1 and C2 bounce coefficient of player and ball.

How can i do?

\$\endgroup\$
0
\$\begingroup\$

The bottom of This page provide clear equation and explanation of 2D circle collision. It's might help. Note: As you see in that page, you collision equation only work in impact line (normal of contact surface) but the tangen velocity still the same cause by no serface friction. the general idea is to transform velocity to tangen and normal velocity. update normal velocity with your equation then transform back to original frame of reference.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This answer would be better if it included a summary of the explanation and calculation from "this page," that way the information is preserved even if the linked resource ever changes, moves, or goes offline. \$\endgroup\$ – DMGregory Jun 30 at 16:58
  • \$\begingroup\$ Okay, I will edit soon thank for feedback. \$\endgroup\$ – M lab Jul 1 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.