What is a alternate option for body Velcotiy?

Making an artillery system, and looking for an alternate way, as body Velocity is now deprecated

Linear velocity is what I use now, it uses attachments and stuff, but in my opinion its better.

I’ll look into it, thanks for the help

1 Like

No problem. I can help with your system because I have made something similar if you need it!

1 Like

Could you give me an example of linear velocity being used?

If you are shooting a part from a cannon, add a ton of force and then destroy the linear velocity to give the part realistic drop and speed. It works a lot like body velocity, you just have to play around with it a little.

Download the world in this post, it helped me a lot.
New Body Movers - Updates / Announcements - DevForum | Roblox

I have a YouTube channel and I am going to release my video tutorial on how to make a ship cannon (can be remodeled and scripted to look like arty, HMG, etc) in a day or two. The linear velocity will be explained there.
Four Corners - YouTube

-- @author lumbergrim
-- @project Artillery System

local Players = game:GetService("Players")


local SPG9 = script.Parent.Parent
local CoreValues = SPG9.CoreVaues
local BackGroundparts = SPG9.BackgroundParts
local Shell = SPG9.Shell
local BarrelBlast = SPG9.BarrelBlast
local MuzzleFlash = SPG9.MuzzleFlash

local seat = SPG9.Seat

function FireTheGun()
	local FiredShell = Shell:Clone()
	
	if CoreValues.IsLoaded.Value == true then
		FiredShell.Transparency = 0
		FiredShell.CFrame = BarrelBlast.CFrame
		FiredShell.Parent = workspace
		FiredShell.CanCollide = false
		FiredShell.Anchored = false
		local BV = Instance.new("LinearVelocity")
		BV.Attachment0 = game.Workspace.Part.Attachment0
		BV.Attachment1 = game.Workspace.Part.Attachment1
		BV.MaxForce = Vector3.new(5000,5000,5000)
		BV.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
		BV.VectorVelocity = Vector3.new(200,200,200)
	end
end


seat.Changed:Connect(function()
	wait(0.5)
	local Plr = Players:GetPlayerFromCharacter(seat.Occupant.Parent)
	local PlayerChar = Plr.Character
	local mouse = Plr:GetMouse()
	
	FireTheGun()
	
	
	
end)

I am trying to do this, but the part just keeps falling down, even though I’ve set attachments to test + added the force

Attachment0 should be in the shell and you don’t need an Attachment1.

function FireTheGun()
	local FiredShell = Shell:Clone()
	
	if CoreValues.IsLoaded.Value == true then
		FiredShell.Transparency = 0
		FiredShell.CFrame = BarrelBlast.CFrame
		FiredShell.Parent = workspace
		FiredShell.CanCollide = false
		FiredShell.Anchored = false
		local attach = Instance.new("Attachment")
		attach.Parent = FiredShell
		local BV = Instance.new("LinearVelocity")
		BV.Attachment0 = FiredShell.Attachment
		BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		BV.VelocityConstraintMode = Enum.VelocityConstraintMode.World
		BV.VectorVelocity = BarrelBlast.CFrame.LookVector * 600
	end
end

This should work.

1 Like

World is not a valid member of “Enum.VelocityConstraintMode”, From where you applied the VelocityConstraintMode did you mispell it?

Probably not, you could just delete that line and it should work just fine.

It is still falling through the earth

Could you take a video of the problem?

That means the force is not being exerted on the object. Make the attachment and linear velocity in the part, not the script and clone that.

I see, and the Vector Velocity I just played around with, Would the “vector Velocity” be changed to where the Bullet will go to?

No, its just the velocity.

local muzzle = --the part where your shell spawns
BV.VectorVelocity = muzzle.CFrame.LookVector * 600

This makes the velocity go in the direction the shell is pointing.

I see, Thanks!

(thirtycharacters thiritycharacters)

No problem! Also make a comment solved so other people don’t get confused it the problem is resolved or not!