using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
public float speed = 0.1f;
void Update()
{
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
{
//触摸位置与上次触摸位置之间的差异
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
transform.Translate(touchDeltaPosition.x * speed, touchDeltaPosition.y * speed, 0);
}
}
}
旋转物体
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerRotate : MonoBehaviour
{
private float xSpeed=150f;
void Start()
{
}