elvinfcb9
(ElvinYaeger)
June 8, 2022, 9:22pm
#1
I was wondering how I would rotate a part on a local axis with a tween. However, whenever the tween plays, the part does not rotate. As shown in the picture I want to rotate the part on one of the local axis (specifically the green one).
local WhirlTween = TweenService:Create(WhirlEffect, TweenInfo, {Size = Vector3.new(13,.1,13), Transparency = 1, CFrame = WhirlEffect.CFrame * CFrame.Angles(0, math.rad(-360), 0)})
WhirlTween:Play()
end)
Maybe this?
Part.CFrame = Part.CFrame * CFrame.Angles(0, math.rad(15), 0)
I don’t know if it’s the right term but is there a way to rotate a part in a local axis through script? Similar to how you rotate parts in Roblox Studio.
[image_2021-04-13_135917]
Forummer
(Forummer)
June 8, 2022, 9:40pm
#3
What you’re referring to is the object’s object space.
local Part = Instance.new("Part")
Part.CFrame = Part.CFrame:ToObjectSpace() * CFrame.Angles(math.pi / 2, 0, math.pi / 2)
Part.Parent = workspace
Here’s a very simple script which rotates a part instance (according to its object space), 180 degrees around both X and Z axis.
Here’s a resource to learn more.
1 Like