Skip to content

Instantly share code, notes, and snippets.

@tracend
Created March 30, 2011 00:10
Show Gist options
  • Save tracend/893625 to your computer and use it in GitHub Desktop.
Save tracend/893625 to your computer and use it in GitHub Desktop.
Unity3D: Simple Bouncing movement - Source: http://wiki.dreamsteep.com/Unity_tools
function OnCollisionEnter (collisionInfo : Collision) {
// print (collisionInfo.gameObject.tag) ; //??? HTH DO I TAG?
// print (collisionInfo.gameObject.transform.position) ;
// if (collisionInfo.gameObject.tag=="sphere"){
var rand: int = Random.Range(-200,200);
collisionInfo.gameObject.rigidbody.AddForce(Vector3.up*500);
collisionInfo.gameObject.rigidbody.AddForce(Vector3.right*rand);
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment