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