Hi, I make a pong but i have one problem…
in Player vs pc mode i cant put a speed for pc player…
this is mi code, i put for the pc position the same of the ball but i want put a limit speed for the pc.
I put Rapit in 1 but dont do anithing… hes move in her velocity… help please
using UnityEngine;
using System.Collections;
public class Adversario : MonoBehaviour {
public Transform bola;
public float Rapit;
void Start () {
}
void FixeUpdate(){
}
void Update () {
Vector3 miPosicion = gameObject.transform.position;
miPosicion.y = bola.position.y;
gameObject.transform.position = miPosicion;
Vector3 velocity = gameObject.rigidbody2D.velocity;
velocity.y = Rapit;
gameObject.rigidbody2D.velocity = velocity;
}
}