- Home /
Question by
BobbleHead · Oct 19, 2011 at 04:07 PM ·
bounce
Help me bounce (make player bounce when landing from a jump)
My player is a ball, and He jumps lovely, however upon landing I'd like him to jump again as you were, but with only half the force to simulate a bounce effect. Perhaps this would repeat again with 1/4 of the original force on the 3rd bounce. But I won't get to far ahead of myself.
The player's jump works as you'd imagine
PlayerScript:
function Update () {
var hit : RaycastHit;
if (Physics.Raycast (transform.position, -Vector3.up, hit, 1.5)) {
if (isFalling==false && Input.GetButtonDown("Jump")){ // only jump from the ground
rigidbody.velocity.y += jumpSpeed;
}
}
}
function Jump (){
if (Input.GetButtonDown("Jump") && isFalling==false){ // only jump from the ground
rigidbody.velocity.y += jumpSpeed;
}
}
I don't really know how i'd even start this, so any pushes in the right direction are welcomed - with open arms.
Comment
Your answer
Follow this Question
Related Questions
Bouncing back 1 Answer
Bouncing objects and Energy loss 2 Answers
Bounce with speed 1 Answer
perfect bounce when a bullet hits a wall 1 Answer
I wanna setup something like Kinematic option on sphere but with collision checker. 0 Answers