So I`am making a hacky sack game but when i kick the object hit just going up with no random direction and force. And I want my character not to hit the object when running.
Here is my code for the player force.
if (canSipa == true)
{
_pitcha.GetComponent().AddForce(new Vector2(1000, 5000));
}
}
and for the object:
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.tag == "Player")
{
_player.GetComponent().canSipa = true;
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision.gameObject.tag == "Player")
{
_player.GetComponent().canSipa = false ;
}
}
↧