-
What do you want to achieve? I want to make a working curtain with tweening.
-
What is the issue? When I use Vector3 to move the curtain, it moves it on the global axis, not the curtain’s one (local).
-
What solutions have you tried so far? I have tries using both Vector3.FromNormalId and Vector3.FromAxis (The “FromAxis” one doesn’t support Left/Right movement, only XYZ)
local TS = game:GetService("TweenService")
local C1 = script.Parent.Soul
local deltaSize = 7
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local props = {
Size = C1.Size + Vector3.FromAxis(Enum.Axis.X)*deltaSize ,
Position = C1.Position + Vector3.FromAxis(Enum.NormalId.Right)*deltaSize/2
}
local propsOpen = {
Size = C1.Size - Vector3.FromAxis(Enum.Axis.X)/deltaSize ,
Position = C1.Position - Vector3.FromNormalId(Enum.NormalId.Left)/deltaSize/2
}
local C1Close = TS:Create(C1, tweeninfo, props)
local C1Open = TS:Create(C1, tweeninfo, propsOpen)
open = true
db = false
script.Parent.Soul.ProximityPrompt.Triggered:connect(function()
if db == false then
db = true
if open == false then
open = nil
C1Open:Play()
wait(2)
open = true
elseif open == true then
open = nil
C1Close:Play()
wait(2)
open = false
end
db = false
end
end)
The “Position” is done correctly only when the part’s axis is the same as the global axis. (The “Size” ones work either way, even if the part is not aligned to the global axis)
Starting point:
What I want to achieve:
What actually happens:
Is there any way my curtain can move left but on its axis and not the global one?