---
tags:
    - "Physics, 3D"
---

# Rigidbody Add Relative Torque

[Physics 3D](../index.md) / [Rigidbody](index.md) / **Rigidbody Add Relative Torque** Torque, Mode

## Description

Executes the Add Relative Torque method on the Rigidbody component

## Parameters

| Name | Description |
| :--- | :---------- |
| Torque |  |
| Mode |  |

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Rigidbody Add Relative Torque")]
    [Category("Physics 3D/Rigidbody/Add Relative Torque", "Torque, Mode")]
    [Description("Executes the Add Relative Torque method on the Rigidbody component")]

    [Image(typeof(IconPhysics), ColorTheme.Type.Lime)]
    [Keywords("Physics, 3D")]

    [Parameter("Torque")]
    [Parameter("Mode")]

    [Serializable]
    public class GenInstructionRigidbody_AddRelativeTorque_2_Vector3Torque_ForceModeMode : Instruction
    {
        [SerializeField] private GetGameObject m_Rigidbody = new GetGameObject(
            new GenTypeGameObject_Rigidbody()
        );

        [SerializeField] private GetVector3 m_Torque = new GetVector3();

        [SerializeField] private ForceMode m_Mode = default;

        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Add Relative Torque");
            return $"{this.m_Rigidbody} {method} ({this.m_Torque}, {this.m_Mode})";
        }

        protected override Awaitable Run(Args args)
        {
            Rigidbody component = this.m_Rigidbody.Get<Rigidbody>(args);
            if (component == null) return Done;

            component.AddRelativeTorque(
                (Vector3) this.m_Torque.Get(args),
                this.m_Mode
            );

            return Done;
        }
    }
}
```

