Hey,
Input.GetKeyDown is not working, all methods of Input not working either.
void Update()
{
if (hasAuthority)
{
// Only allow input for client with authority
var input = new Vector3(Input.GetAxis("Vertical"), 0, 0);
//var rotation = new Vector3(0, Input.GetAxis("Mouse Y"), 0);
//var rotation2 = new Vector3(0, Input.GetAxis("Mouse X"), 0);
var rotation2 = new Vector3(transform.rotation.x, transform.rotation.y, transform.rotation.z);
if (Input.GetKey(KeyCode.A))
{
Debug.Log("a");
rotation2 = new Vector3(0, transform.rotation.y - 0.5f, 0);
transform.Rotate(rotation2);
}
if (Input.GetKey(KeyCode.D))
{
Debug.Log("d");
rotation2 = new Vector3(0, transform.rotation.y + 0.5f, 0);
transform.Rotate(rotation2);
}
rb = GetComponent<Rigidbody>();
rb.rotation.Set(0, transform.rotation.y, 0, transform.rotation.w);
rb.AddForce(input.x * Time.deltaTime * moveSpeed, -0.01f, 0, ForceMode.Acceleration);
var pos = transform.position;
if (Math.Round(pos.x, 5) > Math.Round(posuj.x, 5))
{
rb.AddForce(-1, 0, 0, ForceMode.Force);
}
posuj = transform.position;
}
// Disable physics for peer objects
GetComponent<Rigidbody>().isKinematic = !hasAuthority;
// Update player name
label.text = SteamFriends.GetPersonaName();
}