Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

2D Collision without velocity change

Discussion in 'Physics' started by stefanob, Feb 1, 2019.

  1. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    55
    Hello,

    I have a planet moving around another planet in an ellipse (using gravity). There are constantly collisions between the moving planet and other little objects in space which slow down the planet movement.
    Now I want the planet to keep its velocity.
    I found solutions like saving the velocity in FixedUpdate and applying it in OnCollisionEnter. But since it is many collisions alle the time it doesn't really work.

    Any ideas?

    Thank you!
     
  2. xorpheous

    xorpheous

    Joined:
    Mar 28, 2018
    Posts:
    19
    Have you tried adjusting the masses? Make the planet significantly heavier than the debris particles and these collisions should have a much lower impact on the planet velocity while also preserving scattering behaviour of the debris particles.
     
  3. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    55
    Changing the masses would affect the movement. And I need no impact at all because also low impact would affect the velocity and eventually the planet would go down on the mother planet.
     
  4. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    55
    If anybody else runs into this problem: The solution was to create a child gameobject and add a kinematic Rigidbody and a CircleCollider to it.
     
unityunity