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

Is it possible to do this? math & velocity

Asked by
roquick 41
6 years ago
Edited 6 years ago

I have a ball that moves using the equation: BodyVelocity.Velocity = workspace.Ai.HumanoidRootPart.CFrame.lookVector * 60

it moves perfectly

but is there anyway to detect when the ball reaches the location of the velocity? sort of like a ReachedTarget in BodyPositioning except for BodyVelocity? or at least be able to detect if the ball has already gone across its velocity target?

1
Keep checking how far the position of the ball is from the target. print((Ball.Position - workspace.Ai.HumanoidRootPart.Position).magnitude) protectiveebob 221 — 6y
1
o true, thanks, put this as an answer so I can give you the answer roquick 41 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Keep checking how far the position of the ball is from the target.

print((Ball.Position - workspace.Ai.HumanoidRootPart.Position).magnitude)

I'm pretty new to this site, but I'm trying to only post as answers when I feel I give a solid answer, not just like 'ooh, try this', if you know what I mean.

I'm pretty sure that there's a more efficient way to do this.

1
Thank you roquick 41 — 6y
Ad

Answer this question