Hello, i’ve recently started using fastcast for my blood system, but when i try to make rays on 4 different locations 2 of them go upwards for some reason.
Here is the code.
local fc = require(game.ReplicatedStorage.FastCastRedux)
fc.VisualizeCasts = true
local cast = fc.new()
local MaxDistance = -1
local CastParams = RaycastParams.new()
CastParams.IgnoreWater = true
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.FilterDescendantsInstances = {script.Parent}
local castbehaviour = fc.newBehavior()
castbehaviour.RaycastParams = CastParams
castbehaviour.Acceleration = Vector3.new(-18,-18,-18)
castbehaviour.Gravity = 5
castbehaviour.MaxDistance = 5
castbehaviour.ExtraForce = Vector3.new()
castbehaviour.HighFidelityBehavior = fc.HighFidelityBehavior.Default
castbehaviour.HighFidelitySegmentSize = 0.5
hum = script.Parent.Humanoid
local curhp = hum.Health
hum.HealthChanged:Connect(function(newhp)
if curhp < newhp then return end
local difference = math.abs(curhp - newhp)
print(difference)
local direction = script.Parent.HumanoidRootPart.CFrame.LookVector - Vector3.new(0,1,0)
local direction2 = script.Parent.HumanoidRootPart.CFrame.RightVector - Vector3.new(0,1,0)
local direction3 = script.Parent.HumanoidRootPart.CFrame.LookVector + Vector3.new(0,1,0)
local direction4 = script.Parent.HumanoidRootPart.CFrame.RightVector + Vector3.new(0,1,0)
local origin = script.Parent.HumanoidRootPart.Position
local modspeed1 = (direction * -10)
local modspeed2 = (direction2 * -10)
local modspeed3 = (direction * 10)
local modspeed4 = (direction2 * 10)
cast:Fire(origin,direction,modspeed1,castbehaviour)
cast:Fire(origin,direction2,modspeed2,castbehaviour)
cast:Fire(origin,direction3,modspeed3,castbehaviour)
cast:Fire(origin,direction4,modspeed4,castbehaviour)
curhp = newhp
end)
cast.RayHit:Connect(function(cast, raycastResult)
if raycastResult then
print(raycastResult.Instance.Name)
end
end)
Here’s a screenshot of what happens:
