Make fastCast bullet full ray size?

I’m making a simple gun system using FastCastRedux, I was wondering if there is any way to make it so that the bullet is the size of the whole cast like shown in this image:
(Basically, the bullet doesn’t travel at any speed, it is just a part with a length of the full raycast.)

Here is my code so far. I’m not sure how to implement this.

local function fireBullet(player: Player, mousePosition: Vector3)
	local origin = firePoint.WorldPosition
	local vectorDirection = (mousePosition - origin).Unit
	caster:Fire(origin, vectorDirection, Configuration.bulletSpeed, castBehavior)
end

local function onLengthChanged(cast: any, lastPoint: Vector3, rayDir: Vector3, rayDisplacement: number, segmentVelocity: Vector3, cosmeticBulletObject: Instance?)
	if cosmeticBulletObject then
		local bulletLength = cosmeticBulletObject.Size.Z/2
		local bulletOffset = CFrame.new(0, 0, -(rayDisplacement - bulletLength))
		cosmeticBulletObject.CFrame = CFrame.lookAt(lastPoint, lastPoint + rayDir):ToWorldSpace(bulletOffset)
	end
end

caster.LengthChanged:Connect(onLengthChanged)
events.Fire.OnServerEvent:Connect(fireBullet)

if you aren’t using the projectile system that fastcast is meant for,y ou should probably just not use it and just use normal raycasts instead. when using normal raycast visual check this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.