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.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

2D Collision without velocity change

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

  1. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    58
    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:
    58
    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:
    58
    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