Search Unity

Beginner question (Forces, Joints)

Discussion in 'Physics' started by xennews2018, Oct 9, 2019.

  1. xennews2018

    xennews2018

    Joined:
    Feb 28, 2019
    Posts:
    5
    I am a beginner and still don't quite understand how joints & forces work.

    What I want to do:

    2D view from top down, a motor boat with an attached outboard motor on the rear end. The motor can be switched to forward/backward/off and can also be turned to steer the boat into a certain direction/circle. When the motor is switched on, the boat accelerates until a maximum speed (when the power equals the drag of the water); when the motor is switched off, the boat shall drift until the remaining movement energy is depleted.

    What I know so far:

    Set up 2 sprites for the boat and motor, both with RigidBodies2D. Gravity set to zero and linear & angular drag to a specific value.
    For engine on, put something into the FixedUpdate Method of the motor RigidBody like

    rb2D.AddRelativeForce(forceVector * Time.fixedDeltaTime, ForceMode2D.Impulse);

    What I still need to know:

    It somehow doesn't really work properly. Which joint do I have to use? How do I implement the different directions of the motor and apply the force properly to the joint? Do I add an Impulse or constant force? Why doesn't the boat drift when i turn the motor off?


    Thanks a lot for your help!
    Maria