Код для двох ракеток
public GameObject LeftBat;
public GameObject RightBat;
void Update () {
LeftBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
RightBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
if (Input.GetKey(KeyCode.W)) {
//rb.AddForce(transform.right * (200));
LeftBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, 6f, 0f);
}
else if (Input.GetKey(KeyCode.S)) {
//rb.AddForce(transform.right * (200));
LeftBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, -6f, 0f);
}
if (Input.GetKey(KeyCode.UpArrow)) {
//rb.AddForce(transform.right * (200));
RightBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, 6f, 0f);
}
else if (Input.GetKey(KeyCode.DownArrow)) {
//rb.AddForce(transform.right * (200));
RightBat.GetComponent<Rigidbody>().velocity = new Vector3(0f, -6f, 0f);
}
}