Negate#
Math / Negate
Can Read
Cannot Write
Description#
Flips the sign of every component of a vector, pointing it the opposite way
Parameters#
| Name | Description |
|---|---|
| Vector | The vector that is flipped |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Negate")]
[Category("Math/Negate")]
[Description("Flips the sign of every component of a vector, pointing it the opposite way")]
[Image(typeof(IconMinusCircle), ColorTheme.Type.Yellow)]
[Parameter("Vector", "The vector that is flipped")]
[Keywords("Vector", "Invert", "Opposite", "Reverse", "Minus", "Flip")]
[Serializable]
public class TypeVector3MathNegate : TypeVector3
{
[SerializeField] private GetVector3 m_Vector = new GetVector3();
public override Vector3 GetPreview(GameObject source) => -this.m_Vector.GetPreview(source);
public override Vector3 Get(Args args)
{
return -this.m_Vector.Get(args);
}
public override string ToString()
{
return $"-{this.m_Vector}";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}