using UnityEngine;
using System.Collections;
public class NewBehaviour : MonoBehaviour
{
public GameObject player;
public int speedRotation = 3;
public int speed = 5;
public int jumpSpeed = 50;
void Start()
{
player = (GameObject)this.gameObject;
}
void Update()
{
{
player.transform.position += player.transform.forward * speed * Time.deltaTime;
}
}
}
using UnityEngine;
using System.Collections;
public class camera : MonoBehaviour
{
public GameObject player;
public int speedRotation = 3;
public int speed = 5;
public int jumpSpeed = 50;
void Start()
{
player = (GameObject)this.gameObject;
}
void Update()
{
{
player.transform.position += player.transform.up * speed * Time.deltaTime;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyScript : MonoBehaviour
{
protected Joystick joystick;
void Start()
{
joystick = FindObjectOfType<Joystick>();
}
// Update is called once per frame
void Update()
{
var rigidbody = GetComponent<Rigidbody>();
rigidbody.velocity = new Vector3(joystick.Horizontal * 10f,
rigidbody.velocity.y);
}
}
player.transform.position += player.transform.up * speed * Time.deltaTime;
//проще так
gameObject.transform.position += gameObject.transform.up * speed * Time.deltaTime
если (указанКакКамера == да)
player.transform.position += player.transform.up * speed * Time.deltaTime;
иначе
player.transform.position += player.transform.forward * speed * Time.deltaTime;