I’m making a gun system with FastCast but the bullet direction seems to be pointing to the FirePoint look vector instead of using the given direction that points to the center of the Camera, I really find this weird as the example gun of the module is not limited to the fire point look vector.
I use this to calculate to communicate with server and it haves the direction calculation
gunEvent:FireServer(
"Shot",
{
Direction = CFrame.lookAt(Vector3.new(), workspace.CurrentCamera.CFrame.LookVector).LookVector,
FirePoint = Viewmodel.Core.FirePoint.Position
}
)
This it’s the server response to this event (not the full code but it shows the FastCast things)
local directionRay = params.Direction
local firePoint = params.FirePoint
gunCaster:Fire(
firePoint,
directionRay,
gunSettings.Speed,
gunCasterBehavior
)
gunReplicate:FireAllClients(
'VisualizeBullet',
gun,
firePoint,
directionRay,
gunSettings.ProjectileType,
player
)
These are the behavior params of the caster
local gunCaster = fastCast.new()
local gunCasterBehavior = fastCast.newBehavior()
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {character, gun}
gunCasterBehavior.Acceleration = Vector3.new(0, -10, 0)
gunCasterBehavior.AutoIgnoreContainer = false
gunCasterBehavior.MaxDistance = gunSettings.ShotDistance
And this is the LocalScript that visualizes the bullet (check the server response to know the params on this call)
local gunCasterBehavior = fastCast.newBehavior()
local casterParams = RaycastParams.new()
casterParams.FilterDescendantsInstances = {originalGun, originalGun.Parent}
gunCasterBehavior.Acceleration = Vector3.new(0, -10, 0)
gunCasterBehavior.AutoIgnoreContainer = false
gunCasterBehavior.MaxDistance = gunSettings.ShotDistance
gunCasterBehavior.CosmeticBulletTemplate = script:WaitForChild("Projectile")
gunCasterBehavior.CosmeticBulletContainer = workspace.Terrain
if player ~= params[5] then
gunCaster:Fire(
originalGun.Core.FirePoint.Position,
fireDirection,
gunSettings.Speed,
gunCasterBehavior
)
else
print('VisualEffects Script', fireDirection)
gunCaster:Fire(
firePoint,
fireDirection,
gunSettings.Speed,
gunCasterBehavior
)
end