Hello
I have 2 parts one above another, no rotations:
GreenPart with position 10, 8, 5
OrangePart with position 10, 11, 5
I want to see what is the position of the OrangePart in relation to the GreenPart
When I call
local cf = workspace.OrangePart.CFrame:ToObjectSpace(workspace.GreenPart.CFrame)
print(cf.Position)
I get 0, -3, 0
However I expect to get 0, 3, 0 , because I am translating the CFrame of the OrangePart in the coordinate system of the GreenPart and the OrangePart is 3 studs above it.
I think it needs to be by worldspace because now it’s measuring the orange part’s relation to the green which is -3.
Of couse this is only if you want the distance measured according to the orientation of the world’s x, y, & z axes.
A:ToObjectSpace(B) does not convert A to Bs coordinate system, it does the opposite. It converts B to As coordinate system. Or in other words, it computes “B relative to A”. “GreenPart relative to OrangePart” is (0, -3, 0) (assuming OrangePart is not rotated), so you’re actually getting the expected output.
" To find the CFrame of the football relative to the blue player:
footballCF:ToObjectSpace(bluePlayerCF)"
In this example are we converting the ball’s position to player’s coordinate system or we are converting player’s position to ball’s coordinate system?