Spring Joint Min Distance#
Physics 3D / Joint / Spring Joint / Spring Joint Min Distance
Can Read
Can Write
Description#
The Min Distance property of the Spring 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("Spring Joint Min Distance")]
[Category("Physics 3D/Joint/Spring Joint/Min Distance")]
[Description("The Min Distance property of the Spring Joint component")]
[Image(typeof(IconSpring), ColorTheme.Type.Lime)]
[Keywords("Physics, 3D")]
[Serializable]
public class GenTypeNumber_SpringJoint_MinDistance : TypeNumber
{
[SerializeField] private GetGameObject m_SpringJoint = new GetGameObject(
new GenTypeGameObject_SpringJoint()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_SpringJoint.GetPreview(source);
if (instance == null) return default;
SpringJoint component = instance.GetComponent<SpringJoint>();
return component != null ? component.minDistance : default;
}
public override double Get(Args args)
{
SpringJoint instance = this.m_SpringJoint.Get<SpringJoint>(args);
return instance != null
? instance.minDistance
: default;
}
public override void Set(double value, Args args)
{
SpringJoint component = this.m_SpringJoint.Get<SpringJoint>(args);
if (component != null) component.minDistance = (float) value;
}
public override string ToString()
{
return $"{this.m_SpringJoint} Min Distance";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}