Can i tween an object's local space?

I have a sphere-like wireframe object that i want to spin on its axis, it’s also slightly tilted. Is there any way i can tween the object’s local space? Or am in the wrong area here. I don’t really know what to do cause the object is slightly tilted and all values change when i rotate it.

1 Like

you can tween it with cframe like

local ts = game:GetService("TweenService")

local obj -- your object
local tinfo = tweenInfo.new(1)
local props = {CFrame = } -- here go the local space
local tween = ts:Create(obj,tinfo,props)

its really convenient to use ToWorldSpace and its vector variations. Like this would rotate the sphere 15 degrees along its y axis

myPart.CFrame = myPart.CFrame:ToWorldSpace(CFrame.Angles(0,math.rad(15),0))
1 Like

do you mean y axis in local or world space?

This approach should work just fine:

Part.CFrame = Part.CFrame * CFrame.Angles(0, math.rad(x), 0)

You can then use it with TweenService:

local TweenService = game:GetService("TweenService")

local targetCFrame = Part.CFrame * CFrame.Angles(0, math.rad(x), 0)

local rotateTween = TweenService:Create(Part, TweenInfo.new(1), { CFrame = targetCFrame })
rotateTween:Play()
1 Like

Multiplying a CFrame by another CFrame offsets the first CFrame by the second. CFrame:ToWorldSpace(cf) is equal to CFrame * cf, so it rotates in local space / relative to the part.

Also, he said:

1 Like

Toworldspace actually means something like FromObjectSpaceToWorldSpace

So you input the difference in relative/localspace and the game tranforms the matrix to worldspace

1 Like