Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to detect where an object is going to land?

Asked by 4 years ago

I am currently working on scripting a football. I am trying to figure out a way to know where the ball is going to land, after being thrown. Is this possible? If so, how?

0
You should check out EgoMoose's excellent "Modeling a projectile' s motion". This can help you do what you are trying to do. https://scriptinghelpers.org/guides/modeling-a-projectiles-motion Azicre 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You can check if the football touched something:

game.Workspace.FootBall.Touched:Connect(function()
    local LandedPosition = game.Workspace.FootBall.Position
end)

You don,t need to check if the thing that touched the football is a player, cuz it can also be the basepart, etc.

NOTE: THE FOOTBALL HAS TO BE A PART, NOT A MODEL.

This function will get the part located at the center of the football.

If you wanted to the football to land on a specific part, do this:

game.Workspace.FootBall.Touched:Connect(function(hit)
    if hit.Name == "the specific part's name" then
        local LandedOnPart = hit
    end
end)

Hope this helped!

Ad

Answer this question