Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. 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


    May 15, 2013
    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


    Nov 26, 2017
    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