Hi all,
Recently I’ve been working on a cool tennis game with interesting game mechanics. In order to keep players, I created a bot that you can practice with when there’s nobody in the server to challenge. In order to make sure the AI plays correctly, I used BodyPosition. However, it looks like the bot reacts a little too late, for some reason it’s delayed???
How do I make sure the BodyPosition is not delayed? Here are it’s properties:
This is the script that moves the AI bot:
BP = script.Parent.BodyPosition
P2 = script.Parent.Parent.Parent.Ball
script.Parent.BodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
script.Parent.BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
z = 250.146
while wait() do
if P2.Position.Z > 216.377 then
z = P2.Position.Z
else
z = 250.146
end
BP.position = Vector3.new(P2.Position.X, 83.794, z)
end
I have tried setting the power to 15000 and even higher but despite using a while wait() loop The AI doesn’t even touch the ball. Could it be because of the gravity? Should I use something other than BodyPosition for that? Should I make the NPC taller???
Thanks in advance!