So I have a new camera being made for use with a viewportframe, the camera’s position is made to be set to the position of another object, which I use as the reference point of where the camera should go using itemPreviewCamera.CFrame = CFrame.lookAt(itemPositionReference.CFrame.Position, modelPreview.PrimaryPart.CFrame.Position)
If I understand correctly this should position the camera to the itemPositionReference (the part I am using as a reference of position) and point it torwards modelPreview (the item displayed within the viewportframe)
However, after a bit of (albeit not entirely accurate) fiddling (as studio for some reason doesn’t visually display where cameras are) I managed to determine that the camera is just sitting in the sky around the middle of the workspace, not facing the target, which means neither part of the lookAt worked.
idk how much of that code is commented out because of the word wrap, but you’re placing both the camera and testpart at itemPositionReference and making them both look at modelPreview.PrimaryPart.CFrame.Position. I’m not sure how you set the pivot in the model, but your camera can’t see the part because they’re on the same position.
and yea, you’re using CFrame.lookAt properly
a nice way to debug this is by setting up breakpoints and stepping through the code to see what all your variables/fields are set to. And if you print out a cframe, the first 3 numbers are the XYZ position, so you could use that to see if things are placed correctly
there’s info about debugging here
Just realized that I meant to use cameraPositionReference instead of itemPositionReference for the lookAt(), which, after a bit of other meddling that I forgot exactly, it seems to be fixed, so uh, thanks probably.
Also didn’t help that apparently I wasn’t actually moving one of the two test models I was using properly