What would be a way to visualize each individual raycast here if no result is given (the “bullet” is still in the air)
For context, here are the start values of self._AgentPosition and self._AgentVelocity. “workspace.Part” is just a random, anchored part in workspace.
_AgentPosition = workspace.Part.Position
_AgentVelocity = workspace.Part.CFrame.LookVector * 100
return Promise.Async(function(resolve, reject)
local startTime = tick()
while true do
local deltaTime = game:GetService("RunService").RenderStepped:Wait()
local raycastResult = workspace:Raycast(self._AgentPosition, self._AgentVelocity, self._IgnoreList)
if raycastResult then
resolve(raycastResult.Instance)
return
else
self._AgentVelocity = self._AgentVelocity - (Vector3.new(0, workspace.Gravity, 0) * deltaTime)
self._AgentPosition = self._AgentPosition + self._AgentVelocity * deltaTime
end
end
end)