Hey guys! I am trying to make a working balloon tool, that uses vector force or linear velocity, but all the tutorials are kinda outdated and i cant find a good one that meets what i want.
I know how to use tools and all that but im having trouble making the actual physics of the balloon, i cant get the vector force to an amount that is stable and moves consistently, I also need the player to be able to move around while flying with the balloon too, but not jump obviously.
Have you tried using vector force? I recommend you to make the balloon, and all of the tool parts massless, and when equipped, insert a new instance of vector force in the player’s humanoid root part. Make sure to apply the force at the center of the mass (its a boolian property) and then just set the Y force to desired amount. You will also probably need to make an attachment for it, but as long the ApplyForceAtCenterOfMass is true, it doesnt matter where the attachment is.
Just for an example, to make the player “unaffected” by gravity, the Y force would be
Workspace.Gravity * humanoidRootPart:GetMass()
For another example, to decrease players gravity by half, you can use
(Workspace.Gravity * humanoidRootPart:GetMass()) / 2
And some example tool code here:
local tool = script.Parent
local players = game:GetService("Players")
force = Instance.new("VectorForce")
playerChar = tool.Parent
attachment = Instance.new("Attachment")
attachment.Parent = playerChar.PrimaryPart
attachment.CFrame = CFrame.new()
force.Parent = playerChar.PrimaryPart -- You can use PrimaryPart or HumanoidRootPart (they are the same)
force.Attachment0 = attachment
force.ApplyAtCenterOfMass = true
force.Force = Vector3.new(0,(workspace.Gravity * playerChar.PrimaryPart:GetMass()) / 2,0)
(its untested but should work well)
This does work, but still seems unstable, I want the player to take off immediately once equipping the balloon.
With this method i need to jump first which i dont want and also as for example, when i have 50 balloons collected ( thats what the game is based on ) the player doesnt even lift off the ground but with 100 it flies off into the sky like a rocket HAHA and i want it to be more like a constant force.
I am having trouble understanding the main purpose of what you’re trying to do. So if the player takes off the ground immediately after equpping it, is he ever expected to fall back down with the balloon?
Let me explain in detail, the idea is, you are gathering balloons off a map, after enough balloons gathered u need to equip the balloon tool, then u fly for a certain time based on the number of balloons collected ( every balloon lasts 0.1 s ), the vector force needs to be based on the number of balloons too which i did by multiplying “workspace.Gravity * playerChar.PrimaryPart:GetMass())” by the number of collected balloons, after that time ends the balloons pops and the vector force is removed from the player. The issue is that the vector force doesnt seem to be constant causing for example 5 collected balloons to be useless (the player doesnt even fly at all ) and 10-15 collected balloons to be too much (player flies off the map )
What about then instead of multiplying the antiGravity formula, use it as a baseline force, and then add constant values to it depending on the number of balloons? So it could be something like:
(workspace.Gravity * playerChar.PrimaryPart:GetMass()) + (5 * numberOfBalloons)
This gives more of a “less gravity” effect and makes the player fly only above 150 balloons ( also the fly still doesnt happen directly, have to jump to get the player to fly )
I dont really think there is any other solution than vector forces, so either balance the gravity with prewritten constants to “polish” the flight, or maybe give a small velocity boost to the player on equip to make up for the jumping using
I agree with this approach. One thing is that you shouldn’t forget to set the ‘RelativeTo’ property just in case.
force.RelativeTo = Enum.ActuatorRelativeTo.World