Bullets coming from bottom of baseplate FastCast

Hello ,
I already posted a similar post on here, but because of the lack of code and some errors in my copy pasting and me being bad at explaining I repost it.

So basically I am using @EtiTheSpirit module FastCast and already worked with it before. But for the first time, I encountered a very weird glitch / bug : basically when my gun spawns, and I start shooting, casts come from botton, under baseplate, and more I shoot, casts get further, until disapearing from my sight. I then have to wait 10, 15, 20 seconds for the cast to actually come from my Gun tip.

Code :

local fast_cast = require(game.ReplicatedStorage.shared.casters.FastCastRedux)

local BULLET_GRAVITY = Vector3.new(0, -workspace.Gravity/4, 0);
local BULLET_SPEED
local BULLET_MAX_DIST = 1000
local MIN_BULLET_SPREAD_ANGLE = 1					
local MAX_BULLET_SPREAD_ANGLE = 4					
local BULLETS_PER_SHOT = 1			

local players = game:GetService('Players')
local replicatedStorage = game:GetService('ReplicatedStorage')

fast_cast.VisualizeCasts = true 
fast_cast.DebugLogging = true

local mainCaster = fast_cast.new()

local bullets = {}
local bulletsFolder = workspace.Bullets

local castParams = RaycastParams.new()
castParams.FilterType = Enum.RaycastFilterType.Blacklist
castParams.FilterDescendantsInstances = {bulletsFolder}
castParams.IgnoreWater = true 
castParams.CollisionGroup = "Default"


-- BEHAVOIR SETTINGS  ---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

local behavior = fast_cast.newBehavior()
behavior.RaycastParams = castParams
---------------------------------------------------------------------------------------------------------------------
behavior.MaxDistance = BULLET_MAX_DIST
behavior.Acceleration = BULLET_GRAVITY
behavior.AutoIgnoreContainer = false 

---------------------------------------------------------------------------------------------------------------------
behavior.CosmeticBulletContainer = bulletsFolder
behavior.CosmeticBulletTemplate = replicatedStorage.shared.tracers.basic_tracer


function fc_handler.fire(plr, origin, mousePosition, propreties, isReplicated)

	local direction = CFrame.new(Vector3.new(), mousePosition).LookVector
	local customList = {}
	customList[#customList+1] = plr.Character
	customList[#customList+1] = workspace.Camera
	
	castParams.FilterDescendantsInstances = {bulletsFolder, customList}
	
	mainCaster:Fire(origin, direction, 1000, behavior)
end

function OnRayPierced(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
	local position = raycastResult.Position
	cast:SetPosition(position)
end

function onLenghChanged(cast, lastPoint, direction, length, velocity, bullet)
	if bullet then
		local bulletLength = bullet.Size.Z/2 
		local offset = CFrame.new(0, 0, -(length - bulletLength))
		bullet.CFrame = CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset)
	end
end

function onRayTerminated(cast)
	local cosmeticBullet = cast.RayInfo.CosmeticBulletObject

	if cosmeticBullet == nil then return end 
	
	cosmeticBullet:Destroy()
end

mainCaster.LengthChanged:Connect(onLenghChanged)
mainCaster.CastTerminating:Connect(onRayTerminated)

return fc_handler

Everything seems ok, is it a velocity inheritance problem? Make sure to anchor and set velocity of the view model to zero to avoid a problem like below:

1 Like

Thank you, so anchoring the model would resolve the problem ? Only thing I am bit scary of is animations and positioning.