Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Inside Sphere#

Random / Inside Sphere

  • Can Read

  • Cannot Write

Description#

A random point placed anywhere inside a sphere of the specified radius

Parameters#

Name Description
Radius How far from the center the point can be placed

Code#

using System;
using UnityEngine;
using VisualScript.Icons;
using Random = UnityEngine.Random;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Inside Sphere")]
    [Category("Random/Inside Sphere")]

    [Description("A random point placed anywhere inside a sphere of the specified radius")]
    [Image(typeof(IconDice), ColorTheme.Type.Yellow, typeof(BadgeSphere))]

    [Parameter("Radius", "How far from the center the point can be placed")]

    [Keywords("Dice", "Vector", "Point", "Position", "Scatter", "Spread", "Volume")]

    [Serializable]
    public class TypeVector3RandomInsideSphere : TypeVector3
    {
        [SerializeField] private GetNumber m_Radius = new GetNumber(1f);

        public override Vector3 Get(Args args)
        {
            return Random.insideUnitSphere * this.m_Radius.GetFloat(args);
        }

        public override string ToString()
        {
            return $"Inside Sphere ({this.m_Radius})";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnUpdate;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.