Making the camera follow a part

Hello!
I’m working on a small game, which is an endless runner where the “runner” is a rolling ball. A problem I’m facing right now is with the camera. I tried welding a part to the ball (to place the camera on that part) but when the ball moves the part rolls with it. Any way I can make the camera follow the ball around?

RobloxScreenShot20200213_191005930|690x362

3 Likes

I asked a similar question a while back. Help with Custom Camera Movement I found camera:interpolate to be useful. Perhaps you could adapt my script?

1 Like

You can always set the CameraSubject to the ball.

If that doesn’t work you can use RenderStepped and set the CFrame to look towards the ball each frame.

1 Like

The easy way out is to ignore the orientation of the CFrame such that when you are setting the CFrame of the camera, it is only the positioning of the part.

Camera.CFrame = CFrame.new(Part.CFrame.Position)

The better way would be to, from the client-side, set the CFrame of the part to the ball (again, only by position, not orientation) every frame via RunService.Heartbeat. I’m saying Heartbeat because it would give you a more accurate position when set after every physics update.

I once would say RenderStepped but you should not be using that outside of camera updates or things that should be updating before everything else. Heartbeat gives a more accurate timing.

4 Likes

You could make the ball the player with naming a grouped moddle StarterCharacter and put it under starter player

1 Like