Files
Cielonos/Packages/com.opsive.behaviordesigner/Runtime/Tasks/Actions/Math/RandomOnUnitSphere.cs
2026-05-10 11:47:55 -04:00

31 lines
1.0 KiB
C#

#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("Generates a random Vector3 on a unit sphere (normalized).")]
public class RandomOnUnitSphere : Action
{
[Tooltip("The resulting random Vector3 on a unit sphere.")]
[SerializeField] [RequireShared] protected SharedVariable<Vector3> m_Result;
/// <summary>
/// Generates a random Vector3 on a unit sphere.
/// </summary>
/// <returns>The status of the action.</returns>
public override TaskStatus OnUpdate()
{
m_Result.Value = Random.onUnitSphere;
return TaskStatus.Success;
}
}
}
#endif