_xiaofang/xiaofang/Assets/Script/Character/PlayerMovement_Jpystick.cs

19 lines
487 B
C#
Raw Normal View History

2024-11-12 10:42:00 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement_Jpystick : MonoBehaviour
{
public Joystick joystick; // <20><>Joystick<63><6B><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD>
public float speed = 5f;
void Update()
{
float horizontal = joystick.Horizontal;
float vertical = joystick.Vertical;
Vector3 direction = new Vector3(horizontal, 0, vertical);
transform.Translate(direction * speed * Time.deltaTime, Space.World);
}
}