Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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.