#if GRAPH_DESIGNER /// --------------------------------------------- /// Behavior Designer /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.Math { using Opsive.GraphDesigner.Runtime.Variables; using UnityEngine; [Opsive.Shared.Utility.Category("Math")] [Opsive.Shared.Utility.Description("Rotates a Vector3 around an axis by an angle in degrees.")] public class Vector3Rotate : Action { [Tooltip("The Vector3 to rotate.")] [SerializeField] protected SharedVariable m_Vector; [Tooltip("The axis to rotate around.")] [SerializeField] protected SharedVariable m_Axis = Vector3.up; [Tooltip("The angle in degrees to rotate by.")] [SerializeField] protected SharedVariable m_Angle; [Tooltip("The resulting rotated Vector3.")] [SerializeField] [RequireShared] protected SharedVariable m_Result; /// /// Rotates the Vector3. /// /// The status of the action. public override TaskStatus OnUpdate() { var axis = m_Axis.Value.normalized; m_Result.Value = Quaternion.AngleAxis(m_Angle.Value, axis) * m_Vector.Value; return TaskStatus.Success; } } } #endif