- Home /
the code work bat is not push the ball but with speed of the character ?
the code work but is not push the ball with speed of the character ?
using UnityEngine;
using System.Collections;
public class PlayerControllerP1 : MonoBehaviour {
public float moveSpeed;
private Vector3 moveDirection;
// public float gravity = 20.0F;
void Update()
{
moveDirection = new Vector3(Input.GetAxisRaw("p1 Horizontal"), 0, Input.GetAxisRaw("p1 Vertical")).normalized;
}
void FixedUpdate ()
{
GetComponent<Rigidbody>().MovePosition(GetComponent<Rigidbody>().position + transform.TransformDirection(moveDirection) * moveSpeed * Time.deltaTime);
}
}
Comment
Best Answer
Answer by MarksGames · Apr 20, 2018 at 08:33 PM
Is "p1 Horizontal" defined in the input manager? Make sure it is otherwise Unity won't recognize it. Same goes for p1 Vertical.
yes i have input manager "p1 Horizontal" this not my probel the reason that I have They are the game 8 player for 1 pc