Ceil#
Math / Ceil
Can Read
Cannot Write
Description#
Moves every component of a vector up to the next whole value
Parameters#
| Name | Description |
|---|---|
| Vector | The vector whose components are converted |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Ceil")]
[Category("Math/Ceil")]
[Description("Moves every component of a vector up to the next whole value")]
[Image(typeof(IconVector3), ColorTheme.Type.Yellow, typeof(BadgeCeil))]
[Parameter("Vector", "The vector whose components are converted")]
[Keywords("Vector", "Integer", "Convert", "Whole", "Decimal", "Snap", "Upper")]
[Serializable]
public class TypeVector3MathCeil : TypeVector3
{
[SerializeField] private GetVector3 m_Vector = new GetVector3();
public override Vector3 GetPreview(GameObject source) => Convert(this.m_Vector.GetPreview(source));
public override Vector3 Get(Args args) => Convert(this.m_Vector.Get(args));
private static Vector3 Convert(Vector3 vector)
{
return new Vector3(Mathf.Ceil(vector.x), Mathf.Ceil(vector.y), Mathf.Ceil(vector.z));
}
public override string ToString()
{
return $"Ceil({this.m_Vector})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}