Similar to how you can use CFrame.new(Vector3, lookAt)
, how would I go about pointing the rightVector in a direction rather than the lookVector?
You could just use CFrame.new() as you mentioned (or better CFrame.lookAt) and then rotate by 90 degrees?
I’ve tried this a bit however, do you happen to know which vector I would be rotating the part along?
Rotate it along its local y axis I believe.
CFrame.lookAt(…, …) * CFrame.Angles(0, math.rad(90), 0)
EDIT: Use -90 for RightVector as mentioned by OP.
Due to using the rightVector, I actually had to rotate it by math.rad(-90)
however this worked, thank you!
Its axis of rotation would be the axis in the direction of the vector <0, 1, 0>
https://developer.roblox.com/en-us/api-reference/datatype/CFrame
CFrame.lookAt()
sets the CFrame’s UpVector to Vector3.new(0, 1, 0)
by default.
Not always. We don’t know if the part’s UpVector is going to be <0, 1, 0>. If we want to point the RightVector of a part in a direction by rotating the result of CFrame.lookAt(), we want to rotate it in the part’s local Y axis, not <0, 1, 0>.
I don’t think that “specifying the upward direction (by default, (0, 1, 0))” in the docs means that it sets the cframe upVector to (0,1,0) by default . If it did then you could only “lookAt” things on the same y value.