Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Kicking object with random direction and force 2D

$
0
0
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 ; } }

Viewing all articles
Browse latest Browse all 1264

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>