Do I have to built a connection with Camera to work with it?
``Imprtant before you listen anything: I just want you to understand my problem and give me an explanation - if you have a lot of problems to understand what I mean then please ask me and I will explain you better I mean - anyways I hope you can understand what I mean.`
So what do I want achieve?
I seriously dont want achieve anything I just want say that I cant understand the structure of Camera system. So the ,(look at the script and the picutre), problem I do have is that I cant understand how he works with the Camera. I can understand the whole script but I cant understand the connection between Camera and Tween. It looks like he never use Camera
I will now try to explain better and deeper I hope you can understand what I mean with “connection between Camera and Tween”.
So a Tween has 3 things, like that: TweenService:Create(Object, Info, Property)
but if you look at the picture I have sent here then you may asking urself: I can see a tween but I cant see any connections between the tween and Object. Like there is a creation between a Humanoid and Camera but why doesnt he work with the " local CurrentCamera = workspace.CurrentCamera". So the Object of the Tween should be “CurrentCamera” like:
local TweenCameraOffset = TweenService:Create(CurrentCamera, CameraTweenInfo, CameraOffset)
but it is
local TweenCameraOffset = TweenService:Create(Humanoid, CameraTweenInfo, CameraOffset)
what I cant understand cuz it shows me that there is no connection.
but where is the connection to the Camera?
–Can you follow me here what I am saying to you. I cant see a connection to the Humanoid and the Camera.
So if I have to work with the Camera I need to build a “Connection” or am I wrong?. The TweenameraOffset
The next Question is:
Do I have to build a connection in my tweens with Camera or is it enough to write at the beginning of the script.
local CurrentCamera = workspace.CurrentCamera
local ECS = {}
--- Services ---
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
local TweenService = game:GetService("TweenService")
--- Constants ---
local Player = Players.LocalPlayer
local CurrentCamera = workspace.CurrentCamera
local DefaultFieldOfView = 70
local CameraTweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut) --Feel free to edit your desired tween style or adding more styles as you like
local MouseSensitivity = UserInputService.MouseDeltaSensitivity
--- States ---
local isAligned = false --To define the state when the character facing forward as the camera angle
local isSteppedIn = false --To define the state when moveing camera without right-clicking
--- Functions ---
function ECS:MouseIcon(Status) --To toggle mouse icon
UserInputService.MouseIconEnabled = Status
end
function ECS:MouseLock(Status) --To toggle moving-camera-without-right-clicking mode as well as locking mouse at center of screen
isSteppedIn = Status
end
function ECS:Alignment(Status) --To toggle character alignment to the camera
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.AutoRotate = not Status
isAligned = Status
end
function ECS:CameraMode(Mode) --To toggle different camera modes
if Mode == "Aim" then
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local FieldOfView = {FieldOfView = DefaultFieldOfView - 20} --Edit the amount of FOV that you would like to substract to achieve zoom effect
local CameraOffset = {CameraOffset = Vector3.new(2, 1, 0)} --Edit your desired camera offset
local TweenFieldOfView = TweenService:Create(CurrentCamera, CameraTweenInfo, FieldOfView)
local TweenCameraOffset = TweenService:Create(Humanoid, CameraTweenInfo, CameraOffset)
TweenFieldOfView:Play()
TweenCameraOffset:Play()
UserInputService.MouseDeltaSensitivity = MouseSensitivity / 2 --Edit the amount you would like to lower the mouse sensitivity
end