4ce_e
(4ce)
June 30, 2022, 1:24pm
#1
I am having problems with my tank scope using CFrame.
So basically i was trying to use Camera.CameraSubject = CameraPart
but it was too bad and now im trying to use Camera.CFrame
.
RunService.RenderStepped:Connect(function()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPart.CFrame
end)
This is how i want it to look. (Camera.CameraSubject = CameraPart
)
This is where the camera spins forever using Camera.CFrame
which i want to use for better effect without the infinite spin.
1 Like
On the 2nd clip, the camera isn’t zoomed in all the way. Did you try making the MouseType
LockCenter
?
4ce_e
(4ce)
June 30, 2022, 4:48pm
#3
It’s suppossed to be like this, i am basing off the war thunder scope.
Theres a problem in the Camera.CFrame
when moving the mouse the turret is suppossed to move to the mouse position and not slide to it.
Alright, what’s the problem with Camera.CameraSubject
then? You can wait for it to be changed and change it back to the turret.
4ce_e
(4ce)
June 30, 2022, 5:00pm
#5
No i want to achieve the effect shown in Camera.CameraSubject
video but with CameraCFrame
so players can’t hold right mouse button to rotate the camera around and to fix the camera slide issue.
There u have a video of what do i mean by “Slide”.
If you want, you can set the position of the CFrame to the tank’s turret, and the angle of it to the mouse’s delta.
But, before doing that, do this. When you get into the tank, set UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
4ce_e
(4ce)
June 30, 2022, 5:12pm
#8
Is this what you mean?
local Delta = UserInputService:GetMouseDelta()
cam.CFrame = CamPart.CFrame * CFrame.Angles(0, math.rad(Delta.X), 0)
4ce_e
(4ce)
June 30, 2022, 5:17pm
#9
It kind of works but it cant do a 360* turn.
Alright,y ou did step one. It took longer for me to reply to this, but what you need to do now is orient the camera using the mouse’s delta.
4ce_e
(4ce)
June 30, 2022, 5:40pm
#11
It is Camera.CFrame = CFrame.new(CamPart.Position) * CFrame.Angles(0, math.rad(Deltas.X), 0)
I’m not sure. It depends on what your camera system does.
4ce_e
(4ce)
June 30, 2022, 5:48pm
#13
Alright i will play around with it i’ll respond if i manage to do something,