- Home /
Bouncy platforms/spring jump?
I'm creating a fps set in space. The simulated forest environment is rather large in scale. I was planning on creating separate platforms to the terrain itself (from Cube) to act as something that if jumped onto it would throw you high up into the air to reach for example high cliff edges.
An idea like this is possible?
Much thanks.
Answer by dre38w · Dec 07, 2010 at 01:21 AM
Here's a simple solution.
var bounceForce : float = 10;
function OnCollisionEnter(hit : Collision) { if (hit.gameObject.tag == "Player") { hit.rigidbody.AddForce(bounceForce * transform.up, ForceMode.VelocityChange); } }
This code goes on the platform. The way it works is that the force is being applied to the platform but since the platform doesn't actually move, the force is transferred to the player giving it that bounce effect. I hope that makes sense. There's a bit too much to break down so if you'd like to know what those fancy words are saying you could reference the manual. I hope this helps at all.
Answer by netlander · Dec 23, 2012 at 09:03 AM
In the code above the force is not applied to the platform but to the "hit" object, which is the object that collided with the platform, so there is no magic as such.
Answer by FourOverFive · Apr 30, 2013 at 04:01 AM
can you help me , I am having my ball as the gameobject and I need to bounce everytime it hits a platform. thanks I am a beginner.
Answer by unity_R-rZ_d8Z_D_GiQ · May 13, 2018 at 06:12 PM
Add physics material,Add physics material and add bounce
Your answer
![](https://koobas.hobune.stream/wayback/20220613085702im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Crosshair? How? 6 Answers
Keep player on surface 0 Answers
Can you make a FPS multiplayer on a Android or iOS device? 1 Answer
Character Controller vs RigidBody for FPS 1 Answer
How to gradualy decrease all rigidbody added forces? 0 Answers