- Home /
Question by
adamchakov · Nov 25, 2013 at 04:04 PM ·
physicscharacterbounce
character bounces when landing on a box
hey everyone , my character bounces like forever , and i want him to bounce only if he lands on a top of a box , here's the script that im using ,help me please thanks !
var bounceSpeed = 1.0;
var bounceAmount = 2.0;
function Start () {
for (i = 0; i < 2; i++) {
var t = 0.0;
while (t < 1.0) {
t += Time.deltaTime * bounceSpeed;
transform.position.y = Bounce(t) * bounceAmount;
yield;
}
}
}
function Bounce (t : float) : float {
return Mathf.Sin(Mathf.Clamp01(t) * Mathf.PI);
}
Comment
Your answer
Follow this Question
Related Questions
Bouncing Ball and Walls 1 Answer
Cant find options to change physic material to bouncy 2 Answers
How to make an infinite mass solid body 1 Answer
RIGIDBODY HOW MAKE IT STOP BOUNCING HELP! 3 Answers
Reducing bounce on simple boxes 0 Answers