What is the mathematical function I have to use to match an effect like the one on Studio when you Resize.
Basically I want to resize a rotated brick on an axis and push that brick half of the resize increment on that same axis.
A little like in that GIF:
https://gyazo.com/abf8675b042613900bbc1b7c2307d6ef
I'm pretty sure it has to do with math.sin or math.cos but I'm not that good in trigonometry (I didn't learn that at school yet), so I'm unsure.
I'd really like it to have something like
local increment=.123 local oldCFrame=part.CFrame for i=0,numberoftimes do part.Size=Vector3.new(part.Size.X+increment,part.Size.Y,part.Size.Z) part.CFrame=oldCFrame*CFrame.new(math.sin(part.Rotation.X)*increment/2,blahblah) -- this line is the one i cant figure out end
You don't need math.sin
or anything special, because oldCFrame * relative
has relative
in the object space -- that means x means in the part's x direction.
The line you want is just
part.CFrame = oldCFrame * CFrame.new( increment / 2, 0, 0)
but you have to set oldCFrame
in the loop, just not before it.