Part Tween Rotation

Hello fellow devs,
I have been trying to achieve this:


I have been trying to play around with the Orientation and CFrame but cant get that bounce effect, also I have to find out how to tween the mesh parts all at once. I am also trying to get the bounce to the other side more smooth and less choppy.

Help is appreciated!

1 Like

there is a thing that i think it will work:

  1. in the model create a primaryPart and anchor it and the other parts weld them and unanchor

  2. in the script call:

yourModel.PrimaryPart.CFrame:Lerp("Paste Your CFrame", "type your time (1) second")

i hope it helps :wink:

How would I make it bounce back tho? Like in the video.

is a little trash but i think it works!

while true do
   yourModel.PrimaryPart.CFrame:Lerp("Paste Your CFrame", "type your time (1) second")
   wait("the time of the lerp")
   yourModel.PrimaryPart.CFrame:Lerp("Paste Your CFrame", "type your time (1) second")
    wait("the time of the lerp")
end

oh i remembered something

if you want to ride the airplane idk what to do :smiling_face_with_tear: :sweat_smile:

https://gyazo.com/b9e25d552c45966b0a287fbbf58f4a35.mp4

Now it just spins around.

The Prim parts are slightly rotated.

@matolol2011

Use TweenService on the primary part. You can create an animation, make it repeat forever, and set your easing style to whatever best suits the “bounce” back from either side of the plane’s roll.

local TweenService = game:GetService("TweenService")

local Model = script.Parent
local PrimaryPart = Model.PrimaryPart -- Assuming PrimaryPart is what you want to animate

--[[ 
2 is the time taken to complete the animation.
EasingStyle determines the bounce back effect. 
Leave Direction as InOut otherwise the effect will only happen on one side of the roll
-1 makes the animation repeat forever, true makes it reverse once it reaches the end
--]]
local AnimationInfo = TweenInfo.new(
    2, 
    Enum.EasingStyle.Sine, 
    Enum.EasingDirection.InOut, 
    -1,
    true
) 

-- Play around with whatever angles best suits your needs. Z is for roll which is most likely all you'll need for a simple plane

local StartCFrame = PrimaryPart.CFrame * CFrame.Angles(0, 0, math.rad(10))
local EndCFrame = PrimaryPart.CFrame * CFrame.Angles(0, 0, math.rad(-10))

-- Set the start pose

PrimaryPart.CFrame = StartCFrame

-- Create the animation

local Animation = TweenService:Create(PrimaryPart, AnimationInfo, {["CFrame"] = EndCFrame})
-- CFrame must be written as ["CFrame"] as otherwise it thinks you want to use the inbuilt CFrame library instead of CFrame as an index in the table
Animation:Play()

Note: I have not tested this myself but it should work. If it doesn’t let me know and ill see what i did wrong!

Also, make sure that the rest of your plane is welded to the primary part and that only the primary part is anchored, otherwise the plane will not animate alongside the primary part.

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