-
What do you want to achieve? Keep it simple and clear!
Hello there, I am trying to make an FPS Framework, so far it is working well but I have ran into an issue -
What is the issue? Include screenshots / videos if possible!
The problem here is that my bullets are offset from the mouse
Here I am using FastCast to do the bullets, my code is down below
self._AddConnection(RunService.Heartbeat:Connect(function()
if UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
--shoot
local HolePart = self.Model.HolePart
HolePart.Anchored = true
local HolePos = HolePart.Position
local normalizeRay = workspace.CurrentCamera:ViewportPointToRay(self.Mouse.X, self.Mouse.Y - 36)
local ActiveCast = self.Caster:Fire(HolePos, normalizeRay.Direction, self.GunConfig.BulletSpeed, self.FastCastBehaviour)
self.Springs.shoot:shove(Vector3.new(rng:NextNumber(-0.5, 1), rng:NextNumber(-0.5, 1), rng:NextNumber(-0.5, 1)))
end
--cooldown
end))
What I expected to happen: The bullets are firing and go towards my mouse
What happened: The bullets are offset from the mouse
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried switching to ViewportPointToRay but I still had the same issue
Thank you for reading