I’m working on a code, if playercontroller = false…then you can move the camera.
but the camera won’t work =/
here’s the code:
using UnityEngine;
using System.Collections;
public class Cammouse : MonoBehaviour {
public float Cameraspeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Player.Playercontroller == false)
{
float camMoveH = Input.GetAxis("Horizontal") * Cameraspeed * Time.deltaTime;
transform.Translate(Vector3.right * camMoveH);
float camMoveV = Input.GetAxis("Vertical") * Cameraspeed * Time.deltaTime;
transform.Translate(Vector3.down * camMoveV);
}
//transform.position = new Vector3(Input.mousePosition.x,Input.mousePosition.z);
}
}
and this is the Player code were I made the bool for Playercontroller:
using UnityEngine; using System.Collections;
public class Player : MonoBehaviour {
private float TimeDifference;
public static int Health = 100;
public float Playerspeed;
public static bool Playercontroller = false;
public static Player Instance;
// Use this for initialization
void Awake ()
{
Instance=this;
}
// Update is called once per frame
void Update () {
if (Playercontroller == true)
{
float amtToMoveH = Input.GetAxis("Horizontal") * Playerspeed * Time.deltaTime;
transform.Translate(Vector3.right * amtToMoveH);
float amtToMoveV = Input.GetAxis("Vertical") * Playerspeed * Time.deltaTime;
transform.Translate(Vector3.forward * amtToMoveV);
}