How would I make a perfect anti-gravity force?

Low gravity, try messing around with the formula until you get the antigravity feeling.

1 Like

Iā€™ve already messed around with body positions and their properties, they never worked and they still donā€™t work. The vectorForces worked way better than body positions.

I meant the equation in the heartbeat event.

1 Like

You want to set a float position and not a anti gravity effect. Whatā€™s happening now is an anti gravity effect. Try using AlignPosition. I havenā€™t used it before, but it seems better than BodyPosition ever since they changed how P worked.

2 Likes

You will want to use Align position constraint for this.

Set the Alignment mode to oneattachment and set it to align to a line.

Set the line to be pointing directly upwards with a direction of (0,1,0)

Then just make set the position of the line to whatever high you want your character to be.

You will definitely need to turn on constraints visualizer see what is happening.

5 Likes

I was theory crafting this myself for my own game, VectorForceā€™s and a formula to calculate the magnitude from the players last position would work, you could get the players last position and then use magnitude and RenderStepped to find the position the player moved from and how far and if they are ā€œFallingā€ you will then multiply the VectorForce that you will parent to the HumanoidRootPart by a large integer or what your moving at you could then alter the falling animation and slightly change collision physics.

Iā€™m unsure how you would record a specific value without a ton of ifā€™s but

Iā€™m sure some brilliant coding mind is there that can help make this a reality?

1 Like

I know this is really late and I am new to this forum as well as creating on Roblox, but couldnā€™t you set the local workspace gravity to 0? if this is for a player, and physics are calculated on the server side while the network owner of the player is the player, right?

another way I can imagine is using the difference of y velocity in the first two heartbeats of the script running and for every other heartbeat add that downwards velocity upwards.

local run = game:GetService('RunService')

local function main()
	local part = Instance.new('Part') --this part being the part wanted to deny gravity 
	part.AssemblyLinearVelocity = Vector3.zero --sets vel to zero to make sure the difference is normal and not influenced by other sources 
	run.Heartbeat:Wait()
	local grav : number = part.AssemblyLinearVelocity.Y --finds the difference between the one heartbeat worth of time and well 0
	run.Heartbeat:Connect(function()
		part.AssemblyLinearVelocity += Vector3.new(0,grav,0)
	end)
end

main()
1 Like