Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Translating and resizing a part on an axis?

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

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.