Hey pretty much the title.
I’m looking to tween a model without using welds.
Normally I’d always use welds for tweening, however in this special circumstance I can’t use it, so I’m looking for a different way.
Thank you in advanced!
Hey pretty much the title.
I’m looking to tween a model without using welds.
Normally I’d always use welds for tweening, however in this special circumstance I can’t use it, so I’m looking for a different way.
Thank you in advanced!
You can try tweening the primary part’s cframe
Or you can try using SetPrimaryPartCFrame in a loop instead of tweening, since I know that will for sure move the whole model.
Wouldn’t the PrimaryPart just move by itself instead of the model because it isn’t welded or anything?
Putting in a loop could be possible, but I don’t think it’d be as smooth or anything, so trying to not do so atm
Well doing SetPrimaryPartCframe moves the whole model even if it isn’t welded (saying from experience), so I’m not sure if just changing the primary part’s cframe might do that too, though probably not.
Since SetPrimaryPartCFrame isn’t a property, you can’t tween it and would have to use a loop. Yeah it might be a bit glitchy so it’s probably not the best way.
SetPrimaryPartCFrame is bad because it will slowly offset the parts in your model due to floating point errors. A better alternative would be using PivotTo, since it fixes this issue.
Hey, How would PivotTo work with Tweening?
Same as SetPrimaryPartCFrame, tween a CFrame value, and use that CFrame value in PivotTo. I’ll throw together an example soon.
Edit: Example
-- place the script under a model
local tweenService = game:GetService("TweenService")
local model = script.Parent
local cframeValue = Instance.new("CFrameValue")
cframeValue.Value = model:GetPivot()
local tweenInfo = TweenInfo.new(5)
local tween = tweenService:Create(cframeValue, tweenInfo,
{
Value = CFrame.new(5, 20, 10)
}
)
cframeValue.Changed:Connect(function()
model:PivotTo(cframeValue.Value)
end)
tween:Play()
Alright, thank you for the example, I appreciate it