Api Sandbox Sphere
struct

Sphere

public sealed struct Sphere

Represents a sphere.

Constructors

Sphere(Vector3 center, Single radius)

Properties

Name Type Description
Unit static Sphere A sphere centered at the origin, with radius 1.
Volume Single Volume of this sphere
RandomPointInside Vector3 Returns a random point within this sphere.
RandomPointOnEdge Vector3 Returns a random point on the edge of this sphere.

Methods

Boolean Trace(Ray ray, Single maxDistance, Single distance)

Performs an intersection test between this sphere and given ray.

Boolean Trace(Ray ray, Single maxDistance)

Performs an intersection test between this sphere and given ray.

Boolean Contains(Vector3 value)

Returns true if sphere contains point. False if the point falls outside the sphere.

Single GetVolume()

Get the volume of this sphere

Single GetEdgeDistance(Vector3 localPos)

Calculates the shortest distance from the specified local position to the nearest edge of the object.

Fields

Name Type Description
Center Vector3 Center of the sphere.
Radius Single Radius of the sphere.
Assembly: Sandbox.System Namespace: Sandbox Full Name: Sandbox.Sphere