Usage of VectorToObjectSpace()

I figured this method was just an easy way to utilize ToObjectSpace and ToWorldSpace using Vector3 and they would work the same. But this isn’t true. For example:

local a = CFrame.new(2, 2, 2)
local b = CFrame.new(2, 3, 2) 

print(a:ToObjectSpace(b).Position) -- 0, 1, 0
local a = CFrame.new(2, 2, 2)
local b = Vector3.new(2, 3, 2) 

print(a:VectorToObjectSpace(b)) -- 2, 3, 2

Pretty much why do VectorToObjectSpace and VectorToWorldSpace seem to do nothing at all?

2 Likes

It’s because your CFrame has no rotation, and because VectorToObjectSpace takes in a directional vector, not a positional vector. You want to use PointToObjectSpace.

1 Like