I want to do the same as below: pressing A and D moves the camera left to right as well as rotates the golf club around the ball. It’s like welding but the player can still rotate.
I think you need to set up a custom camera controller to do this like:
local camera, cameraPart = workspace.CurrentCamera, workspace.CameraPart
local rotation = math.rad(9)
local curRot = 0
local camUpdate = "camUpdate"
local rs, uis = game:GetService("RunService"), game:GetService("UserInputService")
if LOCK_CAMERA then
camera.CameraType = "Scriptable"
rs:BindToRenderStep(camUpdate, Enum.RenderPriority.Camera.Value, function(dt)
if uis:IsKeyDown(Enum.KeyCode.A) and not uis:IsKeyDown(Enum.KeyCode.D) then -- ik this is unreliable i think but im trying to help, dont bombard me with corrections ;-;
curRot += -rotation
elseif not uis:IsKeyDown(Enum.KeyCode.A) and uis:IsKeyDown(Enum.KeyCode.D) then
curRot += rotation
else
curRot += 0
end
camera.CFrame = cameraPart.CFrame * CFrame.Angles(0, curRot, 0)
end)
else
camera.CameraType = "Custom"
rs:UnbindFromRenderStep(camUpdate)
end
Where origin is the center cframe with the rotation of where you want it to face
You would likely just do this once each time you go into the swinging mode
I would also use a cframe based thing for the character, basically the same thing as the camera but rotated 90 degrees
These are pretty janky untested additions so it probably needs a bit of ironing out (messing with angles, offsets, backwards characters, cameras, etc etc…), and sorry for intruding