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

throw object at specific direction or angle

$
0
0
I am trying to throw a gameobject on swipe direction similar to paper toss game i tried Addforce but i cant throw at swipe direction please suggest any solution. bottom line : i want to throw object at enemy by swiping. please help me through if(Input.GetMouseButtonDown(0)) { initPos = Input.mousePosition; } if(Input.GetMouseButtonUp(0)) { finalPos = Input.mousePosition; finalPos = Camera.main.ScreenToWorldPoint(finalPos); rigidbodyBox = ball.AddComponent("Rigidbody") as Rigidbody; rigidbodyBox.mass = 5; ball.rigidbody.AddForce(???????)//what should i pass here //****** }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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