So i’m making magic system and I need my fireball to just travel in a straight line without falling. Body velocity achieves this while a linear velocity is affected by gravity and it falls.
Now I know roblox says bodyvelocity shouldn’t be used in new work, but it’s so convenient to just stick it on the fireball and call it a day rather than find out why linear velocity is not working the way I want it to.
To counter the force of gravity? The issue is that I have to know the mass of the fireball I spawn and I don’t know how to calculate that, it’s a model with a lot of parts
never mind i fixed the floating issue but for some reason changing the bodyvelocity to linearvelocity isn’t going smoothly. I changed everything correctly I think but the fireball won’t move forward anymore. What a headache.
local fireball = workspace.MagicAttack:Clone()
local hrp = player.Character.HumanoidRootPart
fireball.PrimaryPart.CFrame = hrp.CFrame
fireball.PrimaryPart.CFrame = CFrame.new(hrp.Position.X, 5, hrp.Position.Z) * hrp.CFrame.Rotation
fireball.Parent = workspace
local debounceTable = {}
fireball.PrimaryPart.Touched:Connect(function(otherpart)
if (game.Players:GetPlayerFromCharacter(otherpart.Parent) == player) then
return
end
local humanoid = otherpart.Parent:FindFirstChild("Humanoid")
if (humanoid and debounceTable[humanoid] ~= true) then
debounceTable[humanoid] = true
humanoid:TakeDamage(10)
end
end)
local bVelocity = Instance.new("LinearVelocity") --this was a body velocity before.
bVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bVelocity.VectorVelocity = Vector3.new(hrp.CFrame.LookVector.X, 0, hrp.CFrame.LookVector.Z) * 40
bVelocity.Parent = fireball.PrimaryPart
fireball.PrimaryPart.Anchored = false
game:GetService("Debris"):AddItem(fireball, 1)
I just noticed that when apply linear velocity to a character, it makes character play running animation. is there way to not trigged the running animation.
Roblox has been shifting toward a constraint-based physics system, which is more efficient and prevents weird behavior at high speeds. The old BodyMover system (including BodyVelocity) was completely phased out because it became unstable and didn’t offer precise control.