API Reference

Class List

pc.BoundingSphere

A bounding sphere is a volume for facilitating fast intersection testing.

// Create a new bounding sphere centered on the origin with a radius of 0.5
var sphere = new pc.BoundingSphere();

Summary

Methods

intersectsRayTest if a ray intersects with the sphere.

Details

Constructor

BoundingSphere([center], [radius])

Creates a new bounding sphere.

// Create a new bounding sphere centered on the origin with a radius of 0.5
var sphere = new pc.BoundingSphere();

Parameters

centerpc.Vec3The world space coordinate marking the center of the sphere. The constructor takes a reference of this parameter.
radiusNumberThe radius of the bounding sphere. Defaults to 0.5.

Methods

intersectsRay(ray, [point])

Test if a ray intersects with the sphere.

Parameters

raypc.RayRay to test against (direction must be normalized).
pointpc.Vec3If there is an intersection, the intersection point will be copied into here.

Returns

Boolean True if there is an intersection.