Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun
public class TankController : MonoBehaviour
{
public Transform cameraTransform;
public Transform obj;
public float moveSpeed = 5f;
public float rotationSpeed = 3.0f
private Rigidbody trb;
private PhotonView phtvw;
void Start()
{
cameraTransform = GameObject.FindWithTag("MainCamera").transform;
trb = GetComponent();
phtvw = GetComponent
();
}
void Update()
{
float movVer = Input.GetAxisRaw("Vertical");
float movHor = Input.GetAxisRaw("Horizontal");
Debug.Log("VertMove " + movVer);
Vector3 rotation = new Vector3(transform.rotation.x, cameraTransform.rotation.eulerAngles.y, transform.rotation.z);
transform.rotation = Quaternion.Euler(rotation)
Vector3 mov = transform.forward * moveSpeed * movVer * Time.deltaTime;
transform.Translate(mov);
}
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... rking-well
Мобильная версия