- Home /
camera rotation apparent to player
ok so im a semi beginner at unity and i need help with my c# script. im trying to get it so the camera rotates left and right with my sphere which is the player i have been working on it for a while but yeah im trying to set a quaternion variable value for my spheres rotation im getting the error that it doesnt understand Camera? help me out in a way i understand thanks Script: using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
public Quaternion player;
public Quaternion camera;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
player = transform.rotation(20, 0, 0, 0);
rb.AddForce(movement * speed);
}
private void LateUpdate()
{
if (Input.GetKeyDown(KeyCode.A))
{
transform.rotation = player + transform.rotation(0, 0, 3, 0)
camera = transform.rotation;
}
}
}
Answer by Coolcreation201YT · Jun 17, 2017 at 09:47 PM
any answers for me? i heard people answer in 15 mins. its been 2 days.
Your answer
Follow this Question
Related Questions
Camera.WorldToScreenPoint Equivalent 1 Answer
how to clamp y axis with Quaternion.Euler in unity 1 Answer
Checking for quaternion values to not be NaN 4 Answers
Camera Rotation Question 1 Answer