Camera Screen To Viewport Point#
Rendering / Camera / Camera Screen To Viewport Point
Description#
Compares the Screen To Viewport Point method of Camera component to another value
Parameters#
| Name | Description |
|---|---|
| Camera | |
| 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;
using UnityEngine.Rendering;
namespace VisualScript.Runtime
{
[Title("Camera Screen To Viewport Point")]
[Category("Rendering/Camera/Screen To Viewport Point")]
[Description("Compares the Screen To Viewport Point method of Camera component to another value")]
[Image(typeof(IconCamera), ColorTheme.Type.Blue)]
[Parameter("Camera")]
[Parameter("Position")]
[Parameter("Value")]
[Serializable]
public class GenConditionVector3_Camera_CheckScreenToViewportPoint_1 : Condition
{
[SerializeField] private GetGameObject m_Camera = new GetGameObject(
new GenTypeGameObject_Camera()
);
[SerializeField] private GetVector3 m_Value = new GetVector3();
[SerializeField] private GetVector3 m_Position = new GetVector3();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Screen To Viewport Point");
string parameters = $"({this.m_Position})";
return $"{this.m_Camera} {method} = {this.m_Value}";
}
protected override bool Run(Args args)
{
Camera component = this.m_Camera.Get<Camera>(args);
if (component == null) return false;
Vector3 value = component.ScreenToViewportPoint(
(Vector3) this.m_Position.Get(args)
);
return value == (Vector3) this.m_Value.Get(args);
}
}
}