Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does a CFrame turn into Vector3 when multiplied?

Asked by 4 years ago
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

0
A CFrame cannot turn into a Vector3 as it is an immutable type. programmerHere 371 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
    )
]]--
Ad

Answer this question