- Home /
Question by
raluca1s · May 16, 2019 at 01:18 PM ·
cameracamera rotate
I want camera to rotate by joystick
I made a 3d game and I want my Rotation camera to be controlled by joystick , this is the script that I use for using the camera as first person controller .I want to add here something like Joystick2 to and to do the rotation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
CharacterController cc;
public Joystick joystick;
// Start is called before the first frame update
void Start()
{
cc = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
float xInput = joystick.Horizontal;
float zInput = joystick.Vertical;
cc.Move(new Vector3(xInput, 0, zInput));
}
}
Comment
Your answer
Follow this Question
Related Questions
FPS Camera Control rotation limits 1 Answer
Camera gets stuck when cursor is locked 0 Answers
First Person Camera looking down 1 Answer
Why is my camera not snapping 90 degrees? 0 Answers
How can I rotate the camera in 90° with pressing one button? 2 Answers