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

Add a force to a ball using the Boxcolliders AXIS

$
0
0
Hello, im pretty new to this, I have googled and tried so many ways, but I cant figure it out. This is the code I have: function OnTriggerEnter (other : Collider) { ball = GameObject.FindWithTag ("Player"); ball.rigidbody.AddForce (-1000, 0, 0); } this actually works. as long as ball does not rotate the axis X Y. My questions are: 1- can I use the local axis from the box collider (in this case I want Y local) to say, Ball you will get force from the Y axis of the boxcollider. I have tried relativeForce and without success. 2- even switching off the collider, the force still exists even though I added only on the onTriggerEnter. why? many thanks in advance.

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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