Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bounce of more than 1?

Discussion in 'Scripting' started by lucashaley, Jan 2, 2011.

  1. lucashaley

    lucashaley

    Joined:
    May 26, 2006
    Posts:
    8
    Heya all --

    I'd like to have a Physic material that propels collision objects, like a super jump pad. Is there a way of setting the "Bounce" of a Physic material to be greater than 1? Or should I go about this in code?

    Thanks for any help --

    -Lucas
     
  2. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    You can not do this with a physic material.
     
  3. Mike L

    Mike L

    Joined:
    Sep 14, 2010
    Posts:
    1,035
    I would probably do this with code
     
  4. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    I'm not yet fully fluent with Unity, but I believe you can, upon colliding, simply increase the force, which will then give the effect you are looking for.
     
  5. Mike L

    Mike L

    Joined:
    Sep 14, 2010
    Posts:
    1,035
    if your objects have rigidbodies you could do something like this:
    Code (csharp):
    1.  
    2. var force : int;
    3.  
    4. function OnTriggerEnter (hit : Collider) {
    5.     if (hit.rigidbody) {
    6.         hit.rigidbody.velocity = transform.TransformDirection(Vector3 (0, force, 0));
    7.     }
    8. }
    9.  
     
    damiantomczak200000 likes this.
  6. animalz

    animalz

    Joined:
    Apr 12, 2010
    Posts:
    1
    Why isn't this a thing? I wouldn't think it would be too hard to implement. Maybe it increases the overall velocity of objects in a scene in a continuous loop, creating havoc? As it is, though, the average velocity of all items in a scene diminishes fairly quickly with time, even with a bounciness of 1 on all objects. Where does the energy go?
     
  7. George Foot

    George Foot

    Joined:
    Feb 22, 2012
    Posts:
    399
    anmalz, most game physics engines are not concerned with conservation of energy or momentum - they just want to extract overlapping objects quickly and accurately. It's often considered a good thing for most games if objects don't bounce off each other much - because in real life, most objects are not very bouncy.