Search Unity

Question Using two rigidbodies in conjunction

Discussion in 'Physics' started by victornor, Nov 23, 2022.

  1. victornor

    victornor

    Joined:
    Jan 17, 2014
    Posts:
    87
    I'm developing a boat game, where I currently have a rigidbody allowing me to make realistic floating physics.
    I'm using forces applied to this same rigidbody for moving the boat, but the floating physics affect the movement of my boat.

    I would like to use floating physics only for visuals and use another rigidbody for the movement of the boat.
    Ideally I would have RB1 only affect y position + xz rotation and have RB2 only affect xz position and y rotation.

    I am aware that this is probably not possible, but maybe I could somehow simulate RB1 and copy y pos + xz rotation from the simulated rigidbody to the movement rigidbody?

    Does anyone have any suggestions to solve this?
    Thanks
     
  2. leebissessar5

    leebissessar5

    Joined:
    Nov 15, 2022
    Posts:
    48
    Hi victornor, can you show how you implemented the buoyant forces in your code? I implemented an autonomous underwater vehicle in unity with added mass forces, drag, buoyant forces, etc., and it works just fine. I didn't implement seakeeping/surface behavior, but I still think I could provide some input. I do not recommend manipulating the positions and rotations of the rigid body as it erases the information about the other forces applied to it.

    Start with showing code, and I believe others will chime in to help as well.