I have a spaceship that will move towards the mouse position when pressing W. When you control it, you have to constantly readjust the camera to face the direction you would like to go. Is there a way to make the camera act as if it was moving with the ship?
Also it would be good to mention that the ship is controlled in 3rd person.
I have tried to set the CFrame of the camera to be behind the ship but it is very jittery and doesn't rotate.
So in a LocalScript you can do this.
local Part = game.Workspace.Part -- Change this to the part game.CurrentCamera.CameraSubject = Part
Sounds like you want to change the CameraType
of the camera to either Follow
or Attach
.
workspace.CurrentCamera.CameraType = Enum.CameraType.Follow -- or workspace.CurrentCamera.CameraType = Enum.CameraType.Attach
Well, it's simple. You just have to loop around the line of code so it keeps changing. and i do recommend changing the camera's cframe instead of its subject
local camerapart = script.Parent --put the attached part here local camera = workspace.CurrentCamera while true do wait(0.01) --make this lower if it's not keeping up camera.CFrame = camerapart.CFrame end
this script might not work cuz i suck or i might not understanded what you said. and idk if theres another efficent way