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

Why does a CFrame turn into Vector3 when multiplied?

print(CFrame.new(5,5,5) * Vector3.new(5,5,5))

I noticed this would return

10,10,10 -- X,Y,Z

and just that

where are the rest of the 9 numbers

Why does it turn into a vector3 when multiplied

1 comment

0

A CFrame cannot turn into a Vector3 as it is an immutable type.

1 answer

The reason it returns only 3 values and not the other 9 is because CFrame * Vector3 returns a Vector3 not a cframe

--[[
	CFrame * Vector3:
	- Returns The Vector3 transformed from Object to World coordinates.
]]--

I tested this out in studio and what it pretty much means is that it adds each value of the CFrame and Vector3 together like this

--[[
	CFrame.new(a, b, c) * Vector3.new(x, y, z)
	
	Output:

	 Vector3.new(
		a + x,
		b + y,
		c + z
	)
]]--

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