Rigidbody Add Torque#
Physics 3D / Rigidbody / Rigidbody Add Torque X, Y, Z, Mode
Description#
Executes the Add Torque method on the Rigidbody component
Parameters#
| Name | Description |
|---|---|
| X | |
| Y | |
| Z | |
| Mode |
Code#
// <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 Torque")]
[Category("Physics 3D/Rigidbody/Add Torque", "X, Y, Z, Mode")]
[Description("Executes the Add Torque method on the Rigidbody component")]
[Image(typeof(IconPhysics), ColorTheme.Type.Lime)]
[Keywords("Physics, 3D")]
[Parameter("X")]
[Parameter("Y")]
[Parameter("Z")]
[Parameter("Mode")]
[Serializable]
public class GenInstructionRigidbody_AddTorque_4_FloatX_FloatY_FloatZ_ForceModeMode : Instruction
{
[SerializeField] private GetGameObject m_Rigidbody = new GetGameObject(
new GenTypeGameObject_Rigidbody()
);
[SerializeField] private GetNumber m_X = new GetNumber();
[SerializeField] private GetNumber m_Y = new GetNumber();
[SerializeField] private GetNumber m_Z = new GetNumber();
[SerializeField] private ForceMode m_Mode = default;
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Add Torque");
return $"{this.m_Rigidbody} {method} ({this.m_X}, {this.m_Y}, {this.m_Z}, {this.m_Mode})";
}
protected override Awaitable Run(Args args)
{
Rigidbody component = this.m_Rigidbody.Get<Rigidbody>(args);
if (component == null) return Done;
component.AddTorque(
(float) this.m_X.Get(args),
(float) this.m_Y.Get(args),
(float) this.m_Z.Get(args),
this.m_Mode
);
return Done;
}
}
}