Hello,
I am using dual touch controls pad in my game.I have a player which I want to rotate in only x and y axis.But when I play it on phone, it rotates in all 3 axis(x,y,z) which I don’t want to happen.Here is the script attached to my player.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
public class Player : MonoBehaviour {
float turnaroundx;
float turnaroundy;
float rotSpeed = 20;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
turnaroundx = CrossPlatformInputManager.GetAxis ("Mouse X")*rotSpeed*Time.deltaTime;
turnaroundy = CrossPlatformInputManager.GetAxis ("Mouse Y")*rotSpeed*Time.deltaTime;
transform.Rotate(Vector3.up, -turnaroundx );
transform.Rotate(Vector3.right, turnaroundy );
}
}