- Home /
How to make a character bounce?
I'm making a game where the character has to reach the top by bouncing on various objects. This is the script I have so far:
var bounce : float = 1.0; var Player : Transform;
function OnCollisionEnter (other : Collision) { bounce = 1.0; if(other.gameObject.tag == "Blue") bounce = 10.0; if(other.gameObject.tag == "Red") bounce = 0.0; if(other.gameObject.tag == "Gold") bounce = 20.0; }
function Update () { if(bounce>1.0) Player.rigidbody.velocity.y = bounce; bounce = 1.0; }
but when I put it on the GameObjects, nothing happens. I make my objects triggers to see if that works but then the player goes right through them. Does the player need a script as well?
Your answer
Follow this Question
Related Questions
Realistic Bouncing Effect 1 Answer
How to add floating bounce effect to sprite? 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Need a script 0 Answers
How to add a function to destroy this gameobject in game. 2 Answers