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

What's the difference between a CFrame and a Vector?

I have this code..

function makeSpiral(numOfParts)
	local lastpart 
	for i=1, numOfParts do
		local Part = Instance.new("Part", game.Workspace)
		Part.BrickColor = BrickColor.White()
		Part.BottomSurface = Enum.SurfaceType.Smooth
		Part.TopSurface = Enum.SurfaceType.Smooth
		Part.Anchored =true
		if not lastpart then
			Part.CFrame = CFrame.new(0,0,0)
			lastpart = Part
		elseif lastpart then
			Part.CFrame = lastpart.CFrame * CFrame.new(-i,0,i) * CFrame.fromEulerAnglesXYZ(0,1,0)
			Part.Size = Vector3.new(i,(0.5 * i),i)
			lastpart = Part
		end
	end
end

function makeTrig()
	local lastpart
	for i=1, 3 do
		local Part = Instance.new("Part", game.Workspace)
		Part.Anchored = true
		Part.BrickColor = BrickColor.White()
		Part.BottomSurface = Enum.SurfaceType.Smooth
		Part.TopSurface = Enum.SurfaceType.Smooth
		if not lastpart then
			Part.CFrame = CFrame.new(0,0,0)
			lastpart = Part
		elseif lastpart then
			Part.CFrame = lastpart.CFrame * CFrame.new(2,0,0)
		end
	end
end

The first makes some spirals, and the second is supposed to make a triangle for some reason it's not an I have no Idea, this is where I get confused, what do I do? Add Vector3 or multiply with CFRame? it's very confusing here?

1 answer

A cframe is a value consisting of rotations and positions. Its used like such, and not limited to; cframe.new(0,0,0) * cframe.fromEulerAnglesXYZ(0,0,0) Position Rotation

Read up on the wiki and experiment with free model scripts. http://wiki.roblox.com/index.php?title=CFrame http://wiki.roblox.com/index.php?title=Vector3

3 comments

0

Whoops wasn't aware of such

0

Woah thanks

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