Why vectortoobjectspace prints this

Why does vectortoobjectspace keep printing 0,5,0 even though parta position changed?

local parta = workspace.PartA
local partb = workspace.PartB

print(parta.Position, partb.Position)
print(parta.CFrame:VectorToObjectSpace(partb.Position))

parta.Position = Vector3.new(5,0,0)

print(parta.CFrame:VectorToObjectSpace(partb.Position))

f99c12fed3922478dd0129141666afaa

image

Simply switch parta and partb in print(parta.CFrame:VectorToObjectSpace(partb.Position))

Also next time make sure to research it on google/AI. If you did make sure to read the default instructions for posting on the dev forum.

It was not stated what you had already tried or what you looked for when researching.

that makes it print this

which doesn’t show that partb is 5 studs above parta at start. I’ve already been looking it up and it didn’t show much, from what I’ve been reading it should show the offset partb is from parta but doesn’t show it’s 5 studs above.

VectorToObject space rotates a vector as if the CFrame on the left side has position 0, 0, 0. So of course changing parta.Position will not effect the result. However, it will effect the result of PointToObjectSpace.

1 Like