ufezor
(ufezor)
July 31, 2024, 11:18am
#1
What do you want to achieve?
A gun system
What is the issue?
The bullet projectile looks glitched whenever I shoot near structures and walls but it looks normal when the area is almost empty
What solutions have you tried so far?
I was looking through the devforum but I haven’t found a solution
The gun uses FastCast and the bullet is in ReplicatedStorage and it has a trail inside
Video of the problem:
Video of how it’s supposed to work:
Any help would be appreciated.
If its indoor and has a trail then fastcast needs this fix
I had the same problem (and also your previous topic thanks for the solution for that as well) and my I believe the issue is due to it being a trail and the ray updates only fires once.
Trails need position change in 2 frames to display, my solution was to delay this and force a change when the ray is hit:
It’s dirty but it’ll work:
local bulletFrameNumberDictionary = {} --Counts how many time the ray has updated
local function rayUpdated(
activateCaster,
segmentOrigin…
ufezor
(ufezor)
July 31, 2024, 11:32am
#3
After implementing that, the bullet does go in the right direction but for some reason its too slow
Probably due to the ray hit function, try changing the distance factor to something like this.
Im at work so I cant explain why or test it out btw. Just my gut feeling based on memory.
local direction = result.Position - bullet.Position
local originalPosition = bullet.Position
task.wait()
print("Move 1")
bullet.CFrame = bullet.CFrame + direction*0.95
task.wait()
print("Move 2")
bullet.CFrame = bullet.CFrame + direction*0.05
end
ufezor
(ufezor)
August 3, 2024, 5:34pm
#5
I am not sure how I will implement it into the ray hit function
Do you know how?
function Hit(Cast,Result)
local Hit = Result.Instance
if Hit then
local humanoid = Hit.Parent:FindFirstChildOfClass("Humanoid") or Hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
UntagHumanoid(humanoid)
TagHumanoid(humanoid, game:GetService("Players"):GetPlayerFromCharacter(Gun.Parent))
humanoid:TakeDamage(Settings.Damage)
end
end
end