I’m trying to make the character fall slowly at a consistent speed. I’ve looked all over the developer hub and the DevForum and have found nothing that works. I’ve tried using BodyForces and BodyVelocities but neither worked.
If anyone could point me in the right direction that would be appreciated.
You could change the gravity of the game. I think you can do this through either workspace or publishing the game.
I think it might affect more than just how slowly your character falls however. I believe it also affects how high they jump
When the gravity is low objects still speed up. I need the speed to be consistent.
Apply a body force to the player following this formula
force = directionDown * (speed (gravity applied to character model * models mass)
The only thing I see this working is with BodyForce.
Apply a body force, to calculate the force you can use Newton’s second law.
F = ma, so if we have a gravitational force then we want to counter that.
local gravityAcceleration = Workspace.Gravity
F = part.Mass * gravityAcceleration
Now just apply the force value F in the opposite direction (up) and the speed should be constant as the resultant forces equal 0
I’m a bit confused what the
directionDown variable is. I tried this but it launches the player into the air.
-(2*(2*(196.2 * Mass))) make sure to make it negative, as thats applying a vector going up (positive value)
I tinkered around with it for a bit and this seemed to work:
2*(.5*(196.2 * Mass))
Mass * 196.2
Also, wrapping your expressions in parenthesis like that can circumvent constant folding. For the simplest bytecode I recommend grouping constants in parenthesis. For example:
(2 * 0.5 * 196.2) * Mass would fold the constants and result in
196.2 * Mass, whereas your original expression would multiply 3 times.
In this case the 2 extra multiplies are insignificant relative to getting the character’s mass, but it’s still good practice.
I’ve been playing around with this and after a big enough height the character starts moving upwards. Is there any solution to this?
Does your player have to have the ability to move around while this happens, or can they only remain still as they slowly fall?
This is for parachuting, so yes they can move around.
Then in this case you’re going to want to apply a constant force to the player that is adjusted for velocity as such:
Put this in the humanoidRootPart in a server script, have a bindable event fire when the player’s parachute activates. I’m going to assume you called it “ParachuteEvent” and it’s parent is game.ReplicatedStorage
local bodyForce = Instance.new("BodyForce")
bodyForce.Force = Vector3.new(0, (script.Parent:GetMass() * workspace.Gravity) * 0.8, 0)
bodyForce.Parent = script.Parent
When they are no longer parachuting, create another BindableEvent to delete the bodyForce.
That’s what I already have. My problem now is that the player starts flying up when there’s a big enough height.
I do not know what’s causing that. I just ran the code in a game of my own and it works out fine. Are there any other forces you aren’t aware of? You also might want to consider chaning 0.8 to 0.1, as the force may be exceeding the mass.
I realised that your code only used the mass of the HumanoidRootPart, and the other code got the mass of the whole character. I fixed that and now it makes little to no difference. I’ve tried both 0.8 and 0.1. Here is my code:
local Force = game.ServerStorage.Other.ParachuteForce:Clone()
Force.Force = Vector3.new(0, (Plr.Character.PrimaryPart:GetMass() * workspace.Gravity) * 0.1, 0)
Force.Parent = Plr.Character.PrimaryPart
I’ve solved this by inserting a BodyVelocity into the parachute, setting the MaxForce to 0,100000,0, setting the power to 10000 and setting the velocity to 0,-10,0.
What I did for my parachuting system in Unity is I would have its local gravity be 0 then have it go on a downgrade force to the earth at a linear rate. Once it collided with anything the force was gone and its gravity was set to the normal one.