Part turns upside down when its CFrame is set (CFrame not upside down)

print(bodyCF:vectorToWorldSpace(Vector3.new(0,1,0))) --(0,1,0)
print(mainBody.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))) --(0,1,0)
mainBody.CFrame=bodyCF
print(mainBody.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))) --(~0,-1,~0)

So neither the part nor the desired CFrame are upside down, but after assignment, somehow the part is upside down.

Details:
-Part is a UnionOperation, welded together with a bunch of other parts (its a model)
-What I do:

  1. Model is cloned and parented to workspace from serverstorage
  2. Model is welded manually by creating Weld, setting params, parenting in jointsservice (each part welded to mainBody)
  3. I try to set CFrame but as shown, it doesnt work too well…
    -Everything is unanchored

bodyCF is calculated as follows:

local bodyOrientation = CFrame.Angles(0,math.pi / 2,0)
local arrivalPos = ... (a valid Vector3, I checked)
local bodyCF=(CFrame.new(Vector3.new(0,0,0),((somePart.Position - arrivalPos)*Vector3.new(1,0,1)).unit) * bodyOrientation) + arrivalPos

And I dont see anything that would cause the values to become invalid somehow (somePart.Position is not equal or even remotely close to arrivalPos)

I tried to reproduce with a simple model of two parts (even with one being single-part unionoperation), but was unable to.

I have same issue with another model in my place, which works basically the same way.

1 Like

Does this always happen? If so you could just always rotate it back.

Well for me it only happens when I spawn the objects (every time, though).

I guess I could try waiting a frame and setting the CFrame again, but that isnt much better than just waiting for the BodyGyro to rotate it around…