In my game there is a sphere part that represet the character of players my game.
Internally the game move the player by changing the player sphere part AssemblyLinearVelocity property.
I move the ball in my game the camera do a weird movement you see in the video. How could I prevent that?
Here is the camera code:
-- this script contain all of the script to control the ball
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local controlEvent = ReplicatedStorage.controlEvent
local CurrentPlayer = game.Players.LocalPlayer
local PlayerBalls = workspace:WaitForChild("PlayersBalls")
workspace.CurrentCamera.CameraSubject = PlayerBalls[tostring(CurrentPlayer.UserId)]
workspace.CurrentCamera.CameraType = Enum.CameraType.Attach
It will work properly, I’ve craeted myself a similiar asset and I didn’t have to modify the CameraType.
The issue with that line of code is that since CameraType Enum.CameraType.Attach rotates the camera as the CameraSubject rotates, and the ball rotates in all 3 axes, you get this strange result (from CameraType documentation).
Leaving CameraType as it is (so it will be Enum.CameraType.Custom) will make it work as intended.