- Home /
Joystick direction To Camera direction Help!!!XD
So I have two Joystick's for 3rd person type of game... What I wanted to do is control the player using a Joystick left(touch) but still relative to the camera...The problem with this code is, if I try and rotate the camera(aim using the right joystick) then move using the left joystick,it still using the Joystick's direction... I have this on my playerMove script:
ROT = Quaternion.Euler(new Vector3(0,Vector3.Angle(myController.transform.position-defaultStickPosition,myController.transform.up),0));
if(Mathf.Sign(myController.transform.position.x-defaultStickPosition.x) == -1){
transform.rotation = Quaternion.Inverse(ROT);}
else{
transform.rotation = ROT;}
transform.Translate(transform.forward*moveSpeed*Time.deltaTime,Space.World);}
And for my camera it has LookAt function so it's always looking at the player Anyone can help?
Answer by amiel_ace · Nov 30, 2014 at 01:06 PM
Ok,I solved it by adding the Joystick direction to Camera direction. But I'm wondering why didn't unity throws up an error. Cause I'm adding a rotation...
Your answer
Follow this Question
Related Questions
3rd person camera/movement 2 Answers
3rd person controller 0 Answers
Regarding transform.position in the roll a ball tutorial 1 Answer
Linecast not working when main character controller is not moving -1 Answers
Standard asset question 1 Answer