How to make a velocity get affected by gravity?

I am trying to make a Demon Step on roblox, and I have an issue, when I perform the action, I stay floating in the air and going forward, instead of getting affected by gravity but still moving forward, here is the code I used

	local function thread1()
		if canMove == true then
			repeat
						BV3.MaxForce = Vector3.new(1,1,1) * math.huge
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42
				wait()  
				game:GetService("RunService").Heartbeat:Wait()
			until canMove == false
		end
	end
2 Likes

You could get the Gravity by using workspace.Gravity, then maybe assign the BV3’s MaxForce property to the Total Mass of the Part?

Probably something like this

local WorldGravity = workspace.Gravity
local Part = Part:GetMass()

local GravityResult = WorldGravity * Part

I no know how physics class work but this is just an example

1 Like

What is Part? do I replace that with HumanoidRootPart? So like

Part = char.HumanoidRootPart:GetMass()
1 Like

The part would be the Part Velocity you’d want to assign it on relative to gravity I believe

So do I do it like this?

				local Gravity = workspace.Gravity
				local Part = char.HumanoidRootPart:GetMass()
				local result = Part * Gravity
						BV3.MaxForce = Vector3.new(result)
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42

Not entirely, you almost had it

Try this:

				local Gravity = workspace.Gravity
				local Part = char.HumanoidRootPart:GetMass()
				local result = Part * Gravity
						BV3.MaxForce = result
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42

(Keeping in mind I am not 100% exact that this will work or not)

1 Like

image

Oh whoops forgot it needs to be a Vector3 value

                local Gravity = workspace.Gravity
				local Part = char.HumanoidRootPart:GetMass()
				local result = Part * Gravity
						BV3.MaxForce = Vector3.new(result, result, result)
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42
1 Like

https://gyazo.com/0031179fd012bd96d8670170df0b1a82
How much I move is very miniscule, so I can’t tell if I get affected by gravity.

Try multiplying the result of the gravity after you’ve done your multiplication

                local Gravity = workspace.Gravity
				local Part = char.HumanoidRootPart:GetMass()
				local result = (Part * Gravity) * 25 --Or something idk
				BV3.MaxForce = Vector3.new(result, result, result)
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42

You’d probably need to experiment around with the number

1 Like

https://gyazo.com/5a49ca04ca5503f2cef7ce518098256d

Just found another issue, if i’m in the air, I still float, and my speed is way higher.

Maybe I think I have it

Set the Y’s MaxForce property to zero

                local Gravity = workspace.Gravity
				local Part = char.HumanoidRootPart:GetMass()
				local result = (Part * Gravity) * 25 --Or something idk
				BV3.MaxForce = Vector3.new(result, 0, result)
				BV3.Velocity = char.HumanoidRootPart.CFrame.LookVector * 42

For the speed, you’d need to adjust your result variable so that you’re able to make it work properly I believe

1 Like