Basically, I’m trying to make the bullet/ray fire exactly where the humanoid root part is stationed when firing, to shoot directly ahead, and it seems to lag behind, I’ve noticed that when I playtest the game it makes a noticeable impact on aiming, and I’d really like to know why it’s doing this (This uses fastcast, by the way)
The specific code used to shoot out the ray in the direction the player
local function fire(player)
if db ~= false then
db = false
local sound = tool.FireSound.Value
workspace.Gun.SoundId = "rbxassetid://"..sound
workspace.Gun:Play()
local origin = tool.Parent.HumanoidRootPart.Position -- here is where the ray originates from
local direction = tool.Parent.HumanoidRootPart.CFrame.LookVector * 500 -- and right here is how the ray calculates the direction.
caster:Fire(origin, direction, 500, castBehavior)
particlePoint.Flash:Emit(350)
wait(0.17)
db = true
end
end
Here the direction is multiplied by 500, and the distance is 500 too so the direction becomes tool.Parent.HumanoidRootPart.CFrame.LookVector * 250000 I am not sure whether this would cause the issue but this is a very long ray. I believe that you could use remove * 500 when you define direction.
Correct me if I am wrong, I haven’t used FastCast before.
The direction line multiplied LookVector * 500 which makes the ray fire 500 studs forward, while the 3rd parameter is the velocity of how fast the rays casted will fly, being 500.
Well, that quite strange, hopefully players will get used to the slight movement delay then, it hopefully shouldn’t affect too much, thank you for all your answers regardless!