Hi, i am making a third person game and i recently got a camera script which works like a GTA camera and by the way prevents the camera to pass through walls and objects, but i want to invert its Y axis configuration 'cause when i slide the mouse forward, the camera goes up, and when sliding backward, the camera goes down, and i don’t like this way. I´m not exactly a programmer (i focus on the visual things) and i wonder if you could help me doing this. The script has some portuguese words (alvo means target and rotacao means rotation) and here it is(thanks for answering):
using UnityEngine;
using System.Collections;
public class collisionCamera : MonoBehaviour {
public Transform alvo;
RaycastHit hit = new RaycastHit();
public float mouseX = 0;
public float mouseY = 0;
public float distCam = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.RotateAround (alvo.position, transform.up, Input.GetAxis ("Mouse X") * mouseX);
transform.RotateAround (alvo.position, transform.right, Input.GetAxis ("Mouse Y") * mouseY);
Vector3 rotacao = transform.eulerAngles;
rotacao.z = 0;
transform.eulerAngles = rotacao;
transform.position = alvo.position - transform.forward * distCam;
if(Physics.Linecast(alvo.position, transform.position, out hit))
transform.position = hit.point+transform.forward*0.4f;
}
}
i want to invert its Y axis configuration 'cause when i slide the mouse forward, the camera goes up, and when sliding backward, the camera goes down, and i don’t like this way
Try that code:
transform.RotateAround (alvo.position, transform.right, -Input.GetAxis ("Mouse Y") * mouseY);
Fix me if I wrong.
use (FlipY ? -1 : 1) , its a great slice of code i found.
in your case
public bool FlipY = true;
transform.RotateAround (alvo.position, transform.right, Input.GetAxis ("Mouse Y") * (FlipY ? -1 : 1) );
@jacobdanielburgess You are God, your solution is amaizing
cheers 
My Code from rotation Camera
private void CalculateInputs()
{
//Raw input & Invert Input Axis
float m_deltaX = m_inputManager.DeltaAction().x * (m_isFlip_X ? -1 : 1);
float m_deltaY = m_inputManager.DeltaAction().y * (m_isFlip_Y ? 1 : -1);
m_deltaInput = new Vector2 (m_deltaX, m_deltaY);
m_deltaInput.Normalize();
// Rotation from Raw input
m_xRot = m_xRot + m_deltaInput.y;
m_yRot = m_yRot + m_deltaInput.x;
// Clamp Rotation
m_xRot = m_isClampXRot ? Mathf.Clamp(m_xRot, m_minClampRotX, m_maxClampRotX) : m_xRot;
m_yRot = m_isClampYRot ? Mathf.Clamp(m_yRot, m_minClampRotY, m_maxClampRotY) : m_yRot;
// Sensitivity
m_xRot = m_shouldUseSensitivity ? m_xRot * m_camSensitivityX: m_xRot;
m_yRot = m_shouldUseSensitivity ? m_yRot * m_camSensitivityY : m_yRot;
//Smooth rotation
// apply rotation to camera
m_camTransform.eulerAngles = new Vector3(m_xRot, m_yRot, 0f);
//applay rotation to body
m_bodyTransform.eulerAngles = new Vector3(0f, m_yRot, 0f);
}