Hello!
I am working on a little ability, where it will send a wave off and the wave will go into multiple parts - I got all the client sided effects to work perfectly.
I try not to do any effects server-sided for performance, so on the server I went to try and simulate where the particles will be a use that as a way to find out which characters are colliding. I am experiencing a weird issue with the CFrames, when you look in one way it works how its supposed to, but if you look 90* to the left or right the hitboxes are not there.
P.S. I only am making these physical hitbox parts for debugging purposes.
The correct way:
The incorrect way, rotating character 90 degrees and reactivating:
Client Script:
--# ITEMS
local player, mode, id = details['player'], details['mode'], details['id']
local characterEffects = EffectManager:get_effects(player)
--# MODE
if (mode == 'start') then
--# ITEMS
local character = details['character']
local HumanoidRootPart = character.PrimaryPart or character:FindFirstChild('HumanoidRootPart')
--# EFFECT
local atomicWave = characterEffects['wave']:Clone()
atomicWave.Parent = workspace.Visuals
atomicWave:SetPrimaryPartCFrame(HumanoidRootPart.CFrame * CFrame.new(0, -3, -8))
Effects:start_object(atomicWave)
--# STORE
Stored[id] = {
['effect'] = atomicWave,
['connections'] = {}
}
elseif (mode == 'send') then
--# ITEMS
local partSpeed = details['speed']
local atomicWave = Stored[id]['effect']
assert(atomicWave, 'Atomic Wave does not exist.')
--# WAVE PARTS
for _, wavePart in pairs(atomicWave:GetChildren()) do
--# REPARENT
wavePart.Parent = workspace.Visuals
--# ITEMS
local partVelocity = ((wavePart.CFrame * CFrame.new(0, 0, -2).Position) - wavePart.Position).Unit * partSpeed
--# VELOCITY
Stored[id]['connections'][wavePart] = RunService.Heartbeat:Connect(function(deltaTime)
--# VELOCITY
wavePart.CFrame += partVelocity * deltaTime
end)
end
end
Server:
--# CALCULATE
local startCFrame = HumanoidRootPart.CFrame * CFrame.new(0, -3, -8)
local targettedCharacters = {}
local partCFrames = {
[1] = startCFrame,
[2] = startCFrame + Vector3.new(3, 0, -9),
[3] = startCFrame + Vector3.new(1, 0, -7),
[4] = startCFrame + Vector3.new(1, 0, 7),
[5] = startCFrame + Vector3.new(3, 0, 9),
}
--# VELOCITIES
for partLabel, startCFrame in pairs(partCFrames) do
--# ITEMS
local partVelocity = ((startCFrame * CFrame.new(0, 0, -2).Position) - startCFrame.Position).Unit * 60
--# VELOCITY
local timeSinceLastLoop = 0
local partConnection
partConnection = RunService.Heartbeat:Connect(function(deltaTime)
--# COOLDOWN
timeSinceLastLoop += deltaTime
if (timeSinceLastLoop <= 1 / 20) then return end
--# VELOCITY
local partSize = partLabel == 1 and Vector3.new(9, 5, 4) or Vector3.new(4, 5, 4)
partCFrames[partLabel] = partCFrames[partLabel] + (partVelocity * deltaTime)
local a = Instance.new('Part', workspace)
a.Size = partSize
a.CFrame = partCFrames[partLabel]
a.Anchored = true
a.CanCollide = false
end)
end