Hi,
I’m having issues with not being able to rotate the camera 180 degrees for mobile for my wall jump system. I don’t know what’s causing this but everything is going through it works on pc perfectly fine.
To wall jump you need to jump on a wall mid air. I detect jumping for mobile from the jump button and UserInputService for pc.
local function Walljump(Humanoid, Root)
local isGrounded = if Humanoid.FloorMaterial == Enum.Material.Air or Humanoid:GetState() == Enum.HumanoidStateType.Freefall then false else true
local frontRay = RaycastUtil.FrontCheck(Root, FrontRayLength, Parameters) :: RaycastResult
if frontRay and CollectionService:HasTag(frontRay.Instance, "Walljump" ) and not isGrounded then
RaycastUtil.DebugAttatchment(frontRay.Position)
RaycastUtil.VisibleRay(Root, frontRay)
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) -- force jump
print("camera") -- prints perfectly fine on both devices
workspace.CurrentCamera.CFrame = CFrame.fromEulerAnglesXYZ(0, math.rad(180) , 0) * workspace.CurrentCamera.CFrame
print("camera2") -- prints perfectly fine on both devices
end
end
local function onJumpRequest(Humanoid, Root)
Walljump(Humanoid, Root)
end
UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.Space then
onJumpRequest(Character.Humanoid, Character.HumanoidRootPart)
end
end)
if UserInputService.TouchEnabled then -- mobile jump detection
local TouchControlFrame = Player
:WaitForChild("PlayerGui")
:FindFirstChild("TouchGui")
:FindFirstChild("TouchControlFrame")
local JumpButton = TouchControlFrame:WaitForChild("JumpButton") :: ImageButton
JumpButton.Activated:Connect(function(inputObject: InputObject, clickCount: number)
onJumpRequest(Character.Humanoid, Character.HumanoidRootPart)
end)
end