Object Position Not Updating in Viewport Frame

I am setting up a viewport frame to display an object. However, I cannot find a way to change the position of the object. Let me explain.

I set up the camera and the object from replicated storage and I parent them to the viewport frame. Then I set their CFrames to where I want them to be. The camera goes to the correct position, however, when I set the CFrame of the object, the new position shows up in the properties window but the object in the viewport frame remains at the position it was in when it was first cloned from replicated storage. Even if I set the CFrame before parenting it to the viewport frame, the same thing happens.

Why is this happening and how can I set it to the correct position? Thanks.

How do you know it hasn’t moved, because it doesn’t appear in the viewportframe? If its position changed in the properties window that means it did change positions. It could just be that the camera isn’t facing the object. When setting the camera’s cframe, pass the object’s new position as the second parameter. This makes the camera face the object.

Object.Position = -- Object's new position
Camera.CFrame = CFrame.new( --[[Camera's new position]], Object.Position)
1 Like

The object is in the viewport frame and I can see it. I know the camera is in the right position because if I change only its CFrame, the object that I see moves relatively. However, when I change only the objects CFrame, it stays in the exact same spot. Since I know it the camera is in the right spot and the image stays the same when I change the object CFrame, I can conclude that the object hasn’t moved.

bump. This question is still not resolved. Help would be appreciated. Thanks

I figured it out. Welds don’t seem to work in viewport frames so when I moved the root part, the rest of the parts did not come with it so it appeared it didn’t move. To fix it, I just had to change the object’s parent to the workspace, then change the CFrame, then set the parent to the viewport frame.

1 Like