Low gravity effect

how would i tween a sort of low gravity floating effect?
like this for example but on a model using tweens

1 Like

with TweenService you want to make use of the reverse parameter in the TweenInfo.new constructor. Set the position slightly higher than it should, tween down and the reverse will bring it back up automatically; complement it with Tween.Completed:Wait() inside a loop.

Now a better approach would be using math.cos(tick()) or math.sin(tick()) on the Y axis of the RootPart’s position, this method doesn’t’ require the RootPart to be anchored which can lead to better gravitational reactions. It’s important to set gravity to 0 or a very low number in order to keep the RootPart in place for long periods.

2 Likes

You can use this script that I made, which is highly customizable.

– Services

local tweenService = game:GetService(“TweenService”)

– Parents & Children

local insertYourPart = script.Parent

– Values

local animationTime = 5 – How long it takes to play the animation

local easingStyle = Enum.EasingStyle.Quad – Style of animation (This can change the animation a lot)

local easingDirection = Enum.EasingDirection.In – How the easying style is played (foward/in, reverse/out, etc)

local repeatCount = math.huge – How many times the animation repeats(math.huge = infinite)

local reverses = true – If true animation reverses when done playing

local delayTime = 2 – How much time before starting the animation

–

local yAxis = 5 – How far up the part goes. You can make it go down too by making it negative

– Tween Service

— Tween Info

local tweenInfo_Hover = TweenInfo.new(
animationTime,
easingStyle,
easingDirection,
repeatCount,
reverses,
delayTime
)

— Animations

local floatAnimation = tweenService:Create(insertYourPart, tweenInfo_Hover, {Position = insertYourPart.Position + Vector3.new(0, yAxis, 0)})

– Loop

while true do
floatAnimation:Play()

floatAnimation.Completed:Wait()
end

If there is anything else you need, just tell me.

2 Likes

hmm that was my idea as well but how would I achieve this? and for the gravity what if i cant change it? how can i still aply a somehwat low gravity on those parts? and will this cause unnecessary spin? if so how can i decrease it to a very very small amount?

ill try it out!

1 Like


This is what it looks like

2 Likes

lol i think i forgot to say its a model! also just noticed we share similar names lol

1 Like

Oh it’s a model alright I can do that for you

2 Likes

In order to this to work, you must have a primary part in the model and anything in the model welded to the primary part and make sure everything in the model that is welded is unanchored. Except for the primary part.

– Services

local tweenService = game:GetService(“TweenService”)

– Parents & Children

local insertYourModel = script.Parent

– Values

local animationTime = 5 – How long it takes to play the animation

local easingStyle = Enum.EasingStyle.Quad – Style of animation (This can change the animation a lot)

local easingDirection = Enum.EasingDirection.In – How the easying style is played (foward/in, reverse/out, etc)

local repeatCount = math.huge – How many times the animation repeats(math.huge = infinite)

local reverses = true – If true animation reverses when done playing

local delayTime = 2 – How much time before starting the animation

–

local heightValue = 5 – How far up the part goes. You can make it go down too by making it negative

– Tween Service

— Tween Info

local tweenInfo_Hover = TweenInfo.new(
animationTime,
easingStyle,
easingDirection,
repeatCount,
reverses,
delayTime
)

— Animations

local floatAnimation = tweenService:Create(insertYourModel.PrimaryPart, tweenInfo_Hover, {CFrame = insertYourModel.PrimaryPart.CFrame * CFrame.new(heightValue, 0, 0)})

– Loop

while true do
floatAnimation:Play()

floatAnimation.Completed:Wait()
end

1 Like

Sorry if I took too long

2 Likes

Tell me if there are any errors and if it worked!

2 Likes

well its working very nicely but it feels more like its bouncing between invisible walls. i tried changing styles easing sytles but i sorta got the same effect

i should be paying you at this point working more hard on this than me :sob:

1 Like

Haha thanks, I think I can do something about It. I’ll try and let you see it

2 Likes

I’m sorry but I tried everything, it just doesn’t work. It’s just the exact same thing. I think the reason why the video you shown was smooth was because it didn’t use Tween Service. Rather it was just an animation. Plus the arms and legs moving too made it look more realistic.

2 Likes

hmm its ok lol it seems that tweening seems to be the issue

2 Likes

Create a local script that runs a renderstepped loop, every frame use a math.sin(tick()) function (make the formula however you want to adjust speed) then take that value and apply it to the C0 [Y] position offset of the lower torso motor 6d to the humanoid root part. I think the motor6d is called “Root”.

But the video you show above is just an animation, but if you wanted to do the up and down movement with code you could do this ^

2 Likes

im doing it on a model and its working good so far this is the code:

script.Parent.A.VectorForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.A:GetMass(), 0)
-- ^ irrelivent rn
while wait(.01) do
	script.Parent:PivotTo(script.Parent.PrimaryPart.CFrame * CFrame.new(0, math.cos(tick()) * .05 , 0))
end

ill take ur advice on renderstepped but the problem is that since the model and the primary part are rotated it doesnt go up and down but a sort of diagnally left and right… how would i fix this?

1 Like

the implementation is correct.

here’s some insights so you don’t have a headache later on:

  • use Stepped, anything else will make the model jitter
  • use delta time to make the fps fixed, right now if you change the fps to 60 it’s going to have a much shorter up-down motion than it should.
  • make sure the primarypart is anchored
1 Like

but then whats the point of the lowgravity?

explain this futher please

this is on a local script but it doesnt work