#Covert keyboard Inputs to touch input

1 messages Β· Page 1 of 1 (latest)

summer rover
#

I am a beginner in this field I know about keyboard inputs but I have no idea in touch inputs in first person character controller , I have searched in YouTube but I am not satisfied and can't able to understand!!

The code is provided below help me please!!

using System.Collections;
using System.Collections.Generic;
using Unity.Android.Gradle.Manifest;
using Unity.VisualScripting;
using UnityEngine;

public class camerarotation : MonoBehaviour
{
new public Transform camera;
public float mousesensitivity;
public Transform player;
float Xrotation;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.None;
    
}

// Update is called once per frame
void Update()
{
   
    
    float mouseX = Input.GetAxis("Mouse X") * mousesensitivity;
    float mouseY = Input.GetAxis("Mouse Y") * mousesensitivity;
    if (Input.GetMouseButton(2))
    {
        player.Rotate(Vector3.up * mouseX);
    }
    if (Input.GetMouseButton(2))
    {
        Xrotation -= mouseY;
        Xrotation = Mathf.Clamp(Xrotation, -85f, 85f);
        camera.localRotation = Quaternion.Euler(Xrotation, 0f, 0f);
    }

}

}

astral star
#

You have to use the new input system packages

summer rover
#

@astral star Iam have no idea πŸ˜… about new input I have coded this with help of brackeys first person controller video. Can you suggest me where I can find the stuff??

astral star
#

How to use Unity New Input System ? In this video you will learn Unity Input System. And we'll Player Control with Unity New Input System.

Enjoy the video β˜•

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
πŸ– Hi Game developer
Welcome to Rehope Games I'm Murat

I share unity tutorial videos on my channel. if you want to make a game with unity (especially 2d...

β–Ά Play video
#

Today we will use the new input system in Unity to add an on-screen joystick to our game. This works on both desktop and mobile phone devices.

Using an on-screen stick will pipe the values to a different control type, aka Gamepad stick, where we can then use an input action asset to read it's value in our script.

β–ΊπŸ“₯ Video Source Code πŸ“₯
https:/...

β–Ά Play video