Hinge Joint Use Spring#
Physics 3D / Joint / Hinge Joint / Hinge Joint Use Spring
Can Read
Can Write
Description#
The Use Spring property of the Hinge Joint component
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
{
[Get]
[Set]
[Title("Hinge Joint Use Spring")]
[Category("Physics 3D/Joint/Hinge Joint/Use Spring")]
[Description("The Use Spring property of the Hinge Joint component")]
[Image(typeof(IconHinge), ColorTheme.Type.Lime)]
[Keywords("Physics, 3D")]
[Serializable]
public class GenTypeBool_HingeJoint_UseSpring : TypeBool
{
[SerializeField] private GetGameObject m_HingeJoint = new GetGameObject(
new GenTypeGameObject_HingeJoint()
);
public override bool GetPreview(GameObject source)
{
GameObject instance = this.m_HingeJoint.GetPreview(source);
if (instance == null) return default;
HingeJoint component = instance.GetComponent<HingeJoint>();
return component != null ? component.useSpring : default;
}
public override bool Get(Args args)
{
HingeJoint instance = this.m_HingeJoint.Get<HingeJoint>(args);
return instance != null
? instance.useSpring
: default;
}
public override void Set(bool value, Args args)
{
HingeJoint component = this.m_HingeJoint.Get<HingeJoint>(args);
if (component != null) component.useSpring = (bool) value;
}
public override string ToString()
{
return $"{this.m_HingeJoint} Use Spring";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}