2 different lookVectors returning the exact same CFrame results

I have 2 stairs, and each have different lookVector values, yet they are both positioned in the exact same orientation. Apart from the x Pos value, the CFrame is identical. Why is the lookVector not being applied correctly??

print(block.Name, lookVector)
block:SetPrimaryPartCFrame(NewCFrame, lookVector)
print(Root.CFrame)

I think it’s probably because the LookVector is just the forward direction compnenet of a CFrame’s orientation, so you need to add it with the Position of the CFrame, and the other thing is that SetPrimaryPartCFrame will only take the first CFrame, ignoring your lookVector because ti expects 1 argument, the CFrame to set it to

Maybe this’ll work?

print(block.Name, lookVector)
block:SetPrimaryPartCFrame(CFrame.lookAt(NewCFrame.Position, NewCFrame.Position + lookVector))
print(Root.CFrame)

Assuming that you want it to look at the lookVector given

It’s close :confused: but it’s not loading the rotation correctly


its lookVector is being saved as -0, 1, -0, but being loaded correctly as -0, 1, -0, but the CFrame print shows a positive 1. And thus the blocks rotation isn’t right

The rotation of the model will depend on how you built it. CFrame.LookVector will get the front forward of the model’s main part.

If you want to know which way is forward on your parts simply do

Part.FrontSurface = "Hinge"

Do you can see which way your parts are facing.

So either you need to reposition the part or set your own rotation by doing

* CFrame.Angles(0,0,0)--

To the CFrame you wish to rotate.

Or use CFrame.new instead without the passing in the second argument to get no rotation.

1 Like