Terrain Sample Height#
Miscellaneous / Terrain / Terrain Sample Height
Description#
Compares the Sample Height method of Terrain component to another value
Parameters#
| Name | Description |
|---|---|
| Terrain | |
| World Position | |
| Compare | |
| 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("Terrain Sample Height")]
[Category("Miscellaneous/Terrain/Sample Height")]
[Description("Compares the Sample Height method of Terrain component to another value")]
[Image(typeof(IconTerrain), ColorTheme.Type.Lime)]
[Parameter("Terrain")]
[Parameter("World Position")]
[Parameter("Compare")]
[Parameter("Value")]
[Serializable]
public class GenConditionNumber_Terrain_CheckSampleHeight_1 : Condition
{
[SerializeField] private GetGameObject m_Terrain = new GetGameObject(
new GenTypeGameObject_Terrain()
);
[SerializeField] private CompareNumber m_Compare = new CompareNumber();
[SerializeField] private GetNumber m_Value = new GetNumber();
[SerializeField] private GetVector3 m_WorldPosition = new GetVector3();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Sample Height");
string parameters = $"({this.m_WorldPosition})";
return $"{this.m_Terrain} {method} {this.m_Compare} {this.m_Value}";
}
protected override bool Run(Args args)
{
Terrain component = this.m_Terrain.Get<Terrain>(args);
if (component == null) return false;
float value = component.SampleHeight(
(Vector3) this.m_WorldPosition.Get(args)
);
return this.m_Compare.Compare(value, (float) this.m_Value.Get(args));
}
}
}