Tweening in a circle

Hello, I am aboslutley horrible with animating things so I was hoping I could use TweenService instead, I’m trying to make a model ‘orbit’ my map using tweenservice.

Like this:
image

I know I can easily tween it across but Im hoping around is possible.
image

Any help is very apricated!

1 Like

I think I know a good solution!

You know when creating a tween you have to define the tween info.
In this tween info there is a point called Enum.EasingStyle.

Try out different easing styles I am pretty sure you will find a good one!

I thought Enum.EasingStyle didnt affect the path just the way it moved along the path.

I found it!!
The perfect easingstyle you should choose is circular!!!
Did it work??

EasingStyles DO NOT AFFECT THE PATH.
EasingStyles only affect how the object moves.

Circular is an easing style that makes the tween move slower as it approaches the target.

3 Likes

Oh you right,
I guess we should make it differently…

I guess you could try to create a small part combine the part that’s supposed to circulate with the small part, which should be in the middle of the map, in a model.

Change the model’s piviot and roate it so it will perfectly circulate.
I am not quite sure if this is the best solution tho…

1 Like

Why code it at all, just attach it to the map with a Motor6D or a Hinge + long invisible part and set it in motion (motor mode on hinge, or just huge TargetAngle on Motor6D). You’d use a Motor6D for something that is not collidable, purely a graphics effect, or a hinge if it’s something that needs to collide with players or objects physically.

1 Like

What you can do is add a part at the centre of the orbit, rotate it forever and weld it to a part on the outer part of the platform.

local rotatingPart = pathtopart

game:GetService("RunService").Heartbeat:Connect(function()
    rotatingPart.CFrame.Orientation = Vector3.new(rotatingPart.CFrame.Orientation.X + 0.01, rotatingPart.CFrame.Orientation.Y, rotatingPart.CFrame.Orientation.Z)
end)
3 Likes

That sounds like a great idea, I’ll that a try now.

I tried it and got this error, I probably messed something up my bad.
image
image

1 Like

This is a fast rotation, but with the number you can set it up!

local Model = workspace.Model
game["Run Service"].Heartbeat:Connect(function()
	Model:PivotTo(Model:GetPivot() * CFrame.Angles(0,1,0))
end)

Good luck!!

1 Like

Or a simpler solution you could do is:

local object = script.Parent —— or workspace:WaitForChild(“blah blah blah”)

local function spinPart(part)
       while task.wait() do
               part.CFrame *= CFrame.fromEulerAnglesXYZ(0,math.rad(5), 0)
               if part == nil then
               break
               end
        end
end

spinPart(object)

You’re probably gonna have to mess around with the math.rad() (radians) number, and put it in the x, y or z area to see which area is used to spin the object.

1 Like

Thanks, I got that to work by putting the part I want rotating in a model with a part on the opposite side of the map.

If you still want to use Tweening, here’s a way to do it:

local Spin1 = TweenService:Create(script.Parent, spininfo, {CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(120), 0, 0)})
local Spin2 = TweenService:Create(script.Parent, spininfo, {CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(240), 0, 0)})
local Spin3 = TweenService:Create(script.Parent, spininfo, {CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(360), 0, 0)})

Spin1:Play()

Spin1.Completed:Connect(function()
	Spin2:Play()
end)

Spin2.Completed:Connect(function()
	Spin3:Play()
end)

Spin3.Completed:Connect(function()
	Spin1:Play()
end)

You might need to change the math.rad(120) on the X-axis to another axis, it depends on your part/model and what you want to do exactly.

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