Rigidbody2D won't move player
I have read all the unity and stackoverflow tickets I can find. None of the suggestions seem to have any affect on my player. I have put in several printouts, and Unity is detecting the input from the horizontal and vertical axis. I did a printout for what the movement vector2, movespeed, and deltaTime value are. The input values are well above the threshold to move something with 0.0001 mass (150,000 base), with the ability go 5x that value when 'boosting'.
I had this working without rigidbody2d, simply by translating the movement to the transform. I want to use rigidbody2d for collision detection. If anyone has any other ideas of how to get this to work I would appreciate it a lot. Attached is an image of the inspector values for this script and the snippit of code I'm using.
private void Awake ()
{
player = gameManager.GetComponent<Manager_Game>().player;
playerBody = player.GetComponent<Rigidbody2D>();
defaultSpeed = moveSpeed;
boostSpeed = moveSpeed * boostRate;
}
public void FixedUpdate()
{
movement.x = Input.GetAxis("Horizontal");
movement.y = Input.GetAxis("Vertical");
//Debug.Log("Movement" + movement);
bUseBoost = Input.GetKey(KeyCode.LeftShift);
if (bUseBoost)
{
moveSpeed = boostSpeed;
}
else
{
moveSpeed = defaultSpeed;
}
//Debug.Log(movement * moveSpeed * Time.deltaTime);
playerBody.AddForce(movement * moveSpeed * Time.deltaTime, ForceMode2D.Force);
}