Вместо того чтобы объект крутился вокруг своей оси на 360 сохраняя компонент Physics Material 2D(при этом кручение воспроизводится touch screen) он улетает вверх, проходит сквозь пол, вместо того чтобы крутиться вокруг своей оси.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SwipeRotate : MonoBehaviour
{
public float speed;
Vector2 pos;
private void Start()
{
speed = 2;
}
private void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
Vector2 posInScreen = touch.position;
if (touch.phase == TouchPhase.Moved)
{
pos = (posInScreen);
}
float Xposition = pos.x;
transform.rotation = Quaternion.Euler(0, 0, Xposition * speed);
}
}
}