Sensei Kendi
β Help w making movement with joystick
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JoystickMovement : MonoBehaviour
{
public Joystick joystick;
public CharacterController controller;
public float speed 12f;
void Update()
{
float x = Input.GetAxis(joystick.Horizontal);
float z = Input.GetAxis(joystick.Vertical);
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
// joystick wont give a value until its dragged far enough away
joystick.DeadZone = 0.2f;
}
}
10 replies