Transform Look At#
Transform / Rotation / Transform Look At WorldPosition, WorldUp
Description#
Rotates the transform so the forward vector points at a target
Parameters#
| Name | Description |
|---|---|
| World Position | |
| World Up |
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("Transform Look At")]
[Category("Transform/Rotation/Look At", "WorldPosition, WorldUp")]
[Description("Rotates the transform so the forward vector points at a target")]
[Image(typeof(IconEye), ColorTheme.Type.Lime)]
[Keywords("Transform")]
[Parameter("World Position")]
[Parameter("World Up")]
[Serializable]
public class GenInstructionTransform_LookAt_2_Vector3WorldPosition_Vector3WorldUp : Instruction
{
[SerializeField] private GetGameObject m_Transform = new GetGameObject(
new GenTypeGameObject_Transform()
);
[SerializeField] private GetVector3 m_WorldPosition = new GetVector3();
[SerializeField] private GetVector3 m_WorldUp = new GetVector3();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Look At");
return $"{this.m_Transform} {method} ({this.m_WorldPosition}, {this.m_WorldUp})";
}
protected override Awaitable Run(Args args)
{
Transform component = this.m_Transform.Get<Transform>(args);
if (component == null) return Done;
component.LookAt(
(Vector3) this.m_WorldPosition.Get(args),
(Vector3) this.m_WorldUp.Get(args)
);
return Done;
}
}
}