Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Is there a way to make two rigidbody2D's act like one is parented to the other?

Discussion in 'Physics' started by Afropenguinn, May 10, 2018.

  1. Afropenguinn

    Afropenguinn

    Joined:
    May 15, 2013
    Posts:
    242
    So basically, I want one rigidbody to rotate and move with respect to the other, but still be free to move around itself. My use case is that I want a space ship that you can enter and travel in from a top down perspective. While outside the ship, you'll be in a dragless environment (being top down, the gravity is essentially determined by drag), but while in the ship it should feel like the ship is stationary, even while it's in motion. I could accomplish this by making the ship's interior a separate "room" that's stationary, but I wanted to at least attempt a seamless transition.

    So far I've tried various joints, having the most luck with the friction joint, with the downside being that the rigidbody in the ship now affects the ship's rigidbody. I'm pretty new to using the physics engine, so any help would be much appreciated!
     
  2. knobblez

    knobblez

    Joined:
    Nov 26, 2017
    Posts:
    61
    it sounds like you have to do this though script mostly.

    if one GO moves out of the radius of the leading GO it will receive force(like a nudge) towards the center of the leading GO.
    i dont think you could accomplish the flowy effect by parenting it because they are locked together.

    is this world super huge? if youre worried about gravity drag changes it must be a large ship inside a very large map...sounds like it anyway.

    you might want to reduce drag onColliderEnter(entering the spaceship)
    and add drag onColliderExit(exiting the spaceship). that should give you a nice effect if you adjust the drag correctly.

    im a noob