Mirror intergrated, WIP on Client Prediction v1

This commit is contained in:
Sewmina
2022-06-14 01:57:42 +05:30
parent 4435d769a6
commit cdaa627f52
14571 changed files with 4207871 additions and 4127496 deletions

View File

@@ -0,0 +1,19 @@
using UnityEngine;
namespace Mirror.Examples.Pong
{
public class Player : NetworkBehaviour
{
public float speed = 30;
public Rigidbody2D rigidbody2d;
// need to use FixedUpdate for rigidbody
void FixedUpdate()
{
// only let the local player control the racket.
// don't control other player's rackets
if (isLocalPlayer)
rigidbody2d.velocity = new Vector2(0, Input.GetAxisRaw("Vertical")) * speed * Time.fixedDeltaTime;
}
}
}