How can you add a parts CFrame to the camera?

title

how would you be able to copy a parts cframe to the camera so it is still the normal camera but whatever movement is on the part, moves the camera

am trying this but it doesnt work

workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CameraPart.CFrame

Have you made the camera scriptable? That might be effecting it.

1 Like

I turned this on but doesn’t seem to work

That code example I put was a guess but am trying to show what I’m trying to do

There’s a part that plays animations and I’d like to try make the camera play these animations, am not sure if that cframe method works

When ran does any errors occur? If so may I see the errors.

1 Like

no errors and the camera flys off right now

Okay so let me just make sure I’m understanding this correctly, you want it so the players camera is moved to where a part is, so the exact position of the part correct?

If so I would recommend just putting it to the exact cframe of the part rather than doing a calculation.

1 Like

no sorry am explaining it bad

basically a part is playing an animation and I’d like the camera to replicate the animation. So you still have full control of the camera but the animation is moving the camera at the same time

could i do something with cframe.angles as i only need the orientation of the part?

Yes you would use CFrame.angles rather than using a part for the positioning, a part would only be used if you was putting the camera to a specific point in the workspace and then allowing you to do the angling, so you are correct you would need to change the angling.

2 Likes

Oh ok How would i be able to add a parts CFrame angle onto the camera? Im not familiar with cframe.angle

1 Like

You can do something such as:

local x, y, z = part.CFrame:ToOrientation() -- Gives us the orientation of the part.
camera.CFrame *= CFrame.Angles(x, y, z)

This adds the Camera’s angle with the part’s angle.

1 Like

thank you this seems to be good
the camera movement is a little strong, is that adjustable in anyway? - ill try changing the animation
and should i be using a camera mode like scriptable?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.