Because we using Input.GetMouseButtonDown in HandleRaycast(), we will get the weapon before our player move into it, but when I click the weapon and then click another point, my player will get the weapon and move to the new position without getting to the weapon pickup position. My question is, Am I missed something that make it happen like this, or it just right and we will fix it later?
The way the code is written right now, the pickup can be picked up just by clicking on it, even if it’s a mile away.
A simple fix to this is to leave the OnTriggerEnter code (so the player picks it up when he gets to it), but in HandleRaycast() to call
controller.GetComponent<Mover>().StartMoveAction(transform.position, 1.0f);
1 Like