Hello, as of again, i want to know how to do this effect:
Ok, i will have to explain, the video quality is for some reason, just no.
What i want to achieve is this: In some games, you can actually press the < > / , . keys to rotate your character, this is something useful for obbies that contains “Wall Hop”.
Whenever you press those keys, your camera will rotate 45 degrees/radians, and not even that, it will actually “center” you, here is what i mean:
Comma pressed:
PhoenixRessusection’s character/HRP is rotated 1 degrees: Rotate him to 0 degrees then.
PhoenixRessusection’s character/HRP is rotated -1 degrees: Rotate him to 45 degrees then.
Period pressed
PhoenixRessusection’s character/HRP is rotated 1 degrees: Rotate him to 0 degrees then.
PhoenixRessusection’s character/HRP is rotated -1 degrees: Rotate him to -45 degrees then.
I heard that this was an roblox’s camera module, but even if it were, i have no idea on how to actually find it.
Here is my current code:
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local LeftRotation = CFrame.Angles(0,math.rad(45),0)
local RightRotation = CFrame.Angles(0,math.rad(-45),0)
-- Sorry if those are reversed XD...
UIS.InputBegan:Connect(function(Input)
local char = plr.Character or plr.CharacterAdded:Wait()
if Input.KeyCode == Enum.KeyCode.Comma then
local OldYCFrame = Camera.CFrame.Y
print("Pressed Comma( , )")
Camera.CFrame = Camera.CFrame * LeftRotation
elseif Input.KeyCode == Enum.KeyCode.Period then
local OldYCFrame = Camera.CFrame.Y
print("Pressed Period( . )")
Camera.CFrame = Camera.CFrame * RightRotation
end
end)
This works just fine(Except without the thing that has knowledge on the player’s rotation and the next one), except that i have noticed an weird like issue, whenever press the keys, my camera also goes down! I tried to do something like this:
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local LeftRotation = CFrame.Angles(0,math.rad(45),0)
local RightRotation = CFrame.Angles(0,math.rad(-45),0)
UIS.InputBegan:Connect(function(Input)
local char = plr.Character or plr.CharacterAdded:Wait()
if Input.KeyCode == Enum.KeyCode.Comma then
local OldYCFrame = Camera.CFrame.Y
print("Pressed Comma( , )")
Camera.CFrame = Camera.CFrame * LeftRotation
Camera.CFrame = Camera.CFrame + Vector3.new(0,OldYCFrame,0)
elseif Input.KeyCode == Enum.KeyCode.Period then
local OldYCFrame = Camera.CFrame.Y
print("Pressed Period( . )")
Camera.CFrame = Camera.CFrame * RightRotation
Camera.CFrame = Camera.CFrame + Vector3.new(0,OldYCFrame,0)
end
end)
But no success, alright, can anyone help me with this / show the camera module of this?(If it exists.)