How would I make a object jump up and spin then fall?

Hello,
I was trying to implement a success animation through code which involved the object jumping into the air and then falling back down. I was able to get this with tweens but it looks rather choppy and bad. How can I achieve this animation using lerp? Any help would be appreciated!

2 Likes

Just do what you usually do with lerp, then rotate as much as you intend to, then lerp back down

Could you provide a code example?

1 Like

Think the only way using lerp for this would be to have 3 respective while loops for each action.

One for using the lerp function to move the part up, one for the rotation, then one to move back down. I can’t give you an example because I can’t access my PC now

could you please send a code snippet!?

Don’t use lerp for things like this, tween is much better suited for what you are needing. Could you send the tween script?

here, do this

local part = game.Workspace.Part -- Your part.
local JumpHeight = 5 --Apex
local RotationDegrees = 360 --How much the part turns.
local AirBornTime = 0.8 --How long your part stays airborn.

wait(2)
--Animation
local info = TweenInfo.new(AirBornTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false)
local goal =  {Rotation = part.Rotation - Vector3.new(0, RotationDegrees / 2, 0)}

local tween = game:GetService("TweenService"):Create(part, info, goal)
tween:Play()

info = TweenInfo.new(AirBornTime / 2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false)
goal =  {Position = part.Position + Vector3.new(0, JumpHeight, 0)}

tween = game:GetService("TweenService"):Create(part, info, goal)
tween:Play()


wait(info.Time)

info = TweenInfo.new(AirBornTime / 2 - 0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
goal =  {Position = part.Position - Vector3.new(0, JumpHeight, 0)}

tween = game:GetService("TweenService"):Create(part, info, goal)
tween:Play()
2 Likes

I think it looks pretty convincing

Wow! Thank you so much I will go ahead and try this out!

Slight Problem the part only goes 180 degrees and not a full 360. Ill play around with the code until I get something though! Thanks for your help!

Also how could I make this work with a model?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.