Search Unity

turning a project using AddTorque

Discussion in 'Scripting' started by Trild123787898, Jan 28, 2020.

  1. Trild123787898

    Trild123787898

    Joined:
    Dec 9, 2018
    Posts:
    206
    I’m doing mechanics for a crane, and I will need to lower or raise the arrow, for which I understand I need AddTorque, but I can’t figure out how to make it turn the arrow to determine the radius so that the fire doesn’t spin constantly, how can I do it?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    You probably don't want AddTorque. Torque is twisting force, so over time your crane will accelerate until it is spinning wildly.

    What you want is to drive track the angle of rotation, and explicitly change it over time from one angle to another, based on user input or whatever. You can parent different GameObjects to each other, perhaps one for left/right, one for up down to get more compound complicated motion, such as a base that rotates, a levering crane, etc.
     
  3. Trild123787898

    Trild123787898

    Joined:
    Dec 9, 2018
    Posts:
    206
    so, only I need to give strength so that it turns, using rigid body