Problem with fastcast

  1. What do you want to achieve? I want my bullet to spawn in the muzzle.

  2. What is the issue?
    image

  3. What solutions have you tried so far? I was trying to find a solution on the devforum.

How do I make the bullet fly straight out of the muzzle? For now its spawning a little further than necessary.

--Server script
	local cast = fastcast.new()
	local behavior = fastcast.newBehavior()

	local params = RaycastParams.new()
	params.FilterDescendantsInstances = {plr.Character}
	params.FilterType = Enum.RaycastFilterType.Exclude

	behavior.RaycastParams = params
	behavior.Acceleration = Vector3.new(0,-workspace.Gravity/2, 0)
	behavior.AutoIgnoreContainer = true
	behavior.CosmeticBulletTemplate = ReplicatedStorage.Bullets.Bullet
	behavior.CosmeticBulletContainer = workspace.Projectiles
	
	cast.LengthChanged:Connect(function(ActiveCast, lastPoint, rayDir, displacement, segmentVelocity, cosmeticBulletObject)
		if cosmeticBulletObject then
			local bulletLength = cosmeticBulletObject.Size.Z / 2
			local offset = CFrame.new(0,0, -(displacement - bulletLength))
			cosmeticBulletObject.CFrame = CFrame.lookAt(lastPoint, lastPoint + rayDir):ToWorldSpace(offset)
		end
	end)

	cast.RayHit:Connect(function(ActiveCast, RaycastResult, segmentVelocity, cosmeticBulletObject)
		local hit = RaycastResult.Instance
		print(hit)
	end)

	local direction = (mouse-muzzlePos)

	cast:Fire(muzzlePos, direction, 300, behavior)

Thats just a visual issue because of the high speed of the projectile. Set VisualizeCasts to true to see the trajectory of the cast and you’ll see that it comes out the muzzle

Yes, but how can I fix it? Is it possible?

Not that i know of, you can only slow down the projectile.