im using fastcast to get bullets working on my gun system
but normally i would make the bullet small about 5 studs long but it doesnt look good for this so i made the bullet really long 88.7 studs on the Z. but now the bullet sometimes will spawn through the gun
is there any way to make the end/back of the bullet spawn at the fire attachment instead of at the middle?
the direction is a WorldCFrame value from an attachment on the gun
this code makes the bullet face the right way
local directionalCFrame = CFrame.new(Vector3.new(), direction.LookVector)
direction = (
directionalCFrame
* CFrame.fromOrientation(0, 0, random:NextNumber(0, math.pi * 2))
* CFrame.fromOrientation(0, 0, 0)
).LookVector
the origin is just a WorldPosition value from an attachment
code to fire
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = customList
params.IgnoreWater = true
local behavior = fastcast.newBehavior()
behavior.RaycastParams = params
behavior.Acceleration = Vector3.new(0, -50, 0)
behavior.AutoIgnoreContainer = false
behavior.CosmeticBulletTemplate = bullet
behavior.CosmeticBulletContainer = workspace
behavior.CanPierceFunction = CanRayPierce
caster:Fire(
origin,
direction * 5000,
settings.bullet_speed,
behavior
)