Good evening, I have been trying to figure out a way to predict a user’s movement based on their humanoid movement, position, and velocity. I can not think of an efficient and effective way to do that.
Any suggestions, tips, and constructive criticisms are welcome here!
Alright, that does sound complicated. So let me make it a bit less complicated.
Let’s assume that you are a guided missile. You do constantly know the enemy’s location, vectors, and velocity. You want to intercept them, rather than chasing them because that is smarter and you have more speed on impact (and way cooler). Despite you knowing their location, vectors, and velocity, their vectors can change and you don’t want to find they banked a hard right at the last second, you want to predict their new reasonable vector to get a more accurate hit.
While this sounds pretty simple to humans, we all know that an optimized and efficient algorithm is needed for computers.
Okay, so currently, I tried the code that I said I was not going to use (HumanoidRootPart.Position + HumanoidRootPart.Velocity). I added in some visualization to the code to make it spawn blocks.
while wait() do
local Player = game.Players.LocalPlayer
local character = Player.Character
if not character or not character.Parent then
character = Player.CharacterAdded:wait()
local HumanoidRootPart = character.HumanoidRootPart
local part = Instance.new("Part", workspace)
part.Position = HumanoidRootPart.Position + HumanoidRootPart.Velocity --1 second ahead
part.Anchored = true
Let’s say that I am going to use this. How would I improve it to get better accuracy?