How to calculate a 2-part projectile path

Basically I have a basketball shooting system, which I have working fine with the basics of getting the ball to go in the rim when a shot should be successful, which is very simple physics/calculus.

What I want to achieve is the ability for a shot to be a “2-part” shot, where the ball hits the backboard and it then goes into the rim.

Like in the Image above, the black line being the original ball path, the red X where it hits the backboard and the gray line being the “2nd” part of the balls path. How would I achieve this?

1 Like

Are you planning on using a CFrame calculation to move the ball in those paths, or are you using a physics based system?

I’ve already made the basic basketball shooting system that works, which is based on physics so I’m planning on using physics for this aswell

Have you tried playing with the Elasiticy Properties of the ball and the backboard to see if they’ll rebound normally without any calculation?

This already happens, but my goal is to purposely make it hit the backboard and go in.

Basically, my shot system works based on a percentage. Whenever a player shoots I calculate the exact velocity I need for the ball to go in the hoop perfectly. Then I take a percentage that is based on many factors, like that particular players height, shooting level, archetype etc and the percent is decided. If the chance is rolled then it will go in perfectly, if the roll is not in their favor I offset the perfect velocity by a little bit so they miss. So I need a way to get the perfect velocity or another way for it to hit the backboard and go in the hoop guaranteed.

Why not change both the velocity and aim slightly.
If the velocity ends up too high and the shot goes slightly right (in your diagram) then it would bounce off into the basket naturally.
Or do you mean that the player intentionally aims high right in order to make the make it bounce in and they get a perfect percentage roll so the bounce shot goes in?

Well the player doesnt aim in my game. You just hold E, and you have a sort of “skill check” where you have to try and time a bar to land right when its about to be full, and you get awarded more % the closer you are. There is no aiming by the player

Also, roblox physics isnt really consistent so even if the first part happens it wont always go in naturally. I want a surefire method to make it replicate that 100% of the time, every time.

2 Likes

The solution was actually extremely simple and I’m disappointed at myself for not figuring out.

Simply reused the exact same system I use to calculate the velocity for the ball to perfectly go in the net, and I just use the point of contact with the backboard as one of the vectors instead of the shot origin.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.