Answer the question
In order to leave comments, you need to log in
Why is the camera in Unity3D to the left of the character?
I attached the camera to the player, and it is to the left of him! The character is to the right of the camera! And I need it to be in the middle!
Here is the script for the camera
using UnityEngine;
public class CamMove : MonoBehaviour
{
public GameObject player;
void Update()
{
transform.position = new Vector3 (player.transform.position.x, player.transform.position.y,-10f);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Controller : MonoBehaviour
{
int speed = 2;
int jump = 10;
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
rb.velocity = new Vector2(Input.GetAxis("Horizontal") * speed, rb.velocity.y);
if (Input.GetKeyDown (KeyCode.Space))
rb.AddForce (Vector2.up * 125);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question