Question by
ItzChris92 · May 01, 2017 at 12:52 PM ·
rotationscripting problemmovementjoysticks
Problem with player direction using virtual joysticks
I've got my josticks setup, the left for player movement and the right for rotation and shooting. The problem I'm having is the left stick takes direction from the right stick into account and so if my player is facing down, for example, my left stick vertical controls will be inverted (down is up, up is down). Is there any easy way to stop this from happening?
EDIT: Below is the movement script, however the problem could also lie in the joystick scripts. I will post them if needed! Thanks for the help in advance!
using UnityEngine;
using System.Collections;
using GeekGame.Input;
public class CubeControl : MonoBehaviour {
public float speed=.1f;
void Update ()
{
transform.Translate(new Vector3(JoystickMove.instance.H,0f,JoystickMove.instance.V)*speed*Time.deltaTime);
transform.LookAt (transform.position+new Vector3(JoystickRotate.instance.H,0f,JoystickRotate.instance.V));
}
}
Comment
Anyone please? Been battering my head with this for a week now