Collider Closest Point#
Physics 3D / Collider / Collider Closest Point
Description#
Compares the Closest Point method of Collider component to another value
Parameters#
| Name | Description |
|---|---|
| Collider | |
| Position | |
| Value |
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("Collider Closest Point")]
[Category("Physics 3D/Collider/Closest Point")]
[Description("Compares the Closest Point method of Collider component to another value")]
[Image(typeof(IconSphereSolid), ColorTheme.Type.Lime)]
[Keywords("Physics, 3D")]
[Parameter("Collider")]
[Parameter("Position")]
[Parameter("Value")]
[Serializable]
public class GenConditionVector3_Collider_CheckClosestPoint_1 : Condition
{
[SerializeField] private GetGameObject m_Collider = new GetGameObject(
new GenTypeGameObject_Collider()
);
[SerializeField] private GetVector3 m_Value = new GetVector3();
[SerializeField] private GetVector3 m_Position = new GetVector3();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Closest Point");
string parameters = $"({this.m_Position})";
return $"{this.m_Collider} {method} = {this.m_Value}";
}
protected override bool Run(Args args)
{
Collider component = this.m_Collider.Get<Collider>(args);
if (component == null) return false;
Vector3 value = component.ClosestPoint(
(Vector3) this.m_Position.Get(args)
);
return value == (Vector3) this.m_Value.Get(args);
}
}
}