Hello,
I can’t explain this very well, but how would I be able to make the camera roll with a part, for example a ship, but still be able to rotate/orbit around it? I see many implementations of this system in current roblox games such as “Project Stardust” or “Starscape”, so I know it should be possible.
I’ve tried messing around with the CFrame and CameraType of the camera, but it either doesn’t work or I end up only being able to look in a fixed direction. I’ve also tried looking for previous answers on the developer hub, but a lot of the solutions I found did not help. I think it should be a relatively easy solution and I’m just too dumb to figure it out lol.
Here’s an example of this system in “Project Stardust”: Imgur: The magic of the Internet
You can see how the camera follows the rotation of the ship but still maintains its ability to orbit around the ship.
I’m just looking for an explanation on how to do this, thanks.
A rudimentary explanation of how this is achieved is that whenever the ship moves, that movement is also applied to the current camera CFrame (“added”, not set). And you will have to fork player module to make the camera relative to the ship or player model, as opposed to world orientation.
I’ve gotten some luck though using CFrame.lookat(), and particularily the 3rd parameter in CFrame.lookat, but can you explain further how I would add the CFrame to the current camera?
I found a solution but its a first person “pilot” camera system. However, it should be fairly easy to modify the solution to create the third person camera system I was originally trying to make.
I used a weld and manipulated the C0 and C1 properties of the weld to set the position and rotation. I then binded mousemovement to a function that uses the delta.Y and delta.X movement to add onto C0’s X and Y components, while setting its Z component to 0. After this calculation was done I clamped the weld C0 to limit the turning radius of the camera.