- Home /
Question by
1Theo01 · Dec 19, 2017 at 09:32 PM ·
cameracamera rotatefps controllercamera rotation
I'm trying to create an FPS script but something I'm not getting faser is what the rotation limiters are for x please someone help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movimentacaofps : MonoBehaviour
{
public Transform mt;
public float rotcamcb;
public Vector3 rotcam;
public Transform corpopersonajen;
public float velocidade;
public float sensiblidade;
public float sensiblidadeJ;
public float sensiblidadeJ1;
public float velocidade1;
// public Vector3 rotaçaocamera;
// Use this for initialization
void Start()
{
sensiblidadeJ1 = 250;
velocidade1 = 12;
velocidade = velocidade1 * Time.deltaTime;
sensiblidade = 2;
sensiblidadeJ = sensiblidadeJ1 * Time.deltaTime;
}
// Update is called once per frame
void Update()
{
corpopersonajen.Translate(Input.GetAxis("Horizontal") * velocidade ,0,0);
corpopersonajen.Translate(0, 0, Input.GetAxis("Vertical") * velocidade);
corpopersonajen.Rotate(0, Input.GetAxis("DJde") * sensiblidadeJ, 0);
corpopersonajen.Rotate(0, Input.GetAxis("Mouse X") * sensiblidade, 0);
mt.Rotate(Input.GetAxis("DJcb") * sensiblidade, 0, 0);
mt.Rotate(Input.GetAxis("Mouse Y") * sensiblidadeJ, 0, 0);
rotcam = transform.eulerAngles;
rotcamcb = rotcam.x;
}
}
Comment
Your answer
Follow this Question
Related Questions
How to allow camera to complete an upside down rotation while using LookAt() 0 Answers
Camera movement according to rotation and actual position RTS 1 Answer
RTS Camera control - Rotation with MMB 0 Answers
Make 3rd-person character smoothly rotate with mouse camera 0 Answers
Camera defaulting to -90 Y 0 Answers