Engine API Reference - v2.7.3
    Preparing search index...

    Class SphereGeometry

    A procedural sphere-shaped geometry.

    Typically, you would:

    1. Create a SphereGeometry instance.
    2. Generate a Mesh from the geometry.
    3. Create a MeshInstance referencing the mesh.
    4. Create an Entity with a RenderComponent and assign the MeshInstance to it.
    5. Add the entity to the Scene.
    // Create a mesh instance
    const geometry = new pc.SphereGeometry();
    const mesh = pc.Mesh.fromGeometry(app.graphicsDevice, geometry);
    const material = new pc.StandardMaterial();
    const meshInstance = new pc.MeshInstance(mesh, material);

    // Create an entity
    const entity = new pc.Entity();
    entity.addComponent('render', {
    meshInstances: [meshInstance]
    });

    // Add the entity to the scene hierarchy
    app.scene.root.addChild(entity);

    Hierarchy (View Summary)

    Index

    Constructors

    • Create a new SphereGeometry instance.

      By default, the constructor creates a sphere centered on the object space origin with a radius of 0.5 and 16 segments in both longitude and latitude. The sphere is created with UVs in the range of 0 to 1.

      Parameters

      • Optionalopts: {
            calculateTangents?: boolean;
            latitudeBands?: number;
            longitudeBands?: number;
            radius?: number;
        } = {}

        Options object.

        • OptionalcalculateTangents?: boolean

          Generate tangent information. Defaults to false.

        • OptionallatitudeBands?: number

          The number of divisions along the latitudinal axis of the sphere. Defaults to 16.

        • OptionallongitudeBands?: number

          The number of divisions along the longitudinal axis of the sphere. Defaults to 16.

        • Optionalradius?: number

          The radius of the sphere. Defaults to 0.5.

      Returns SphereGeometry

      const geometry = new pc.SphereGeometry({
      radius: 1,
      latitudeBands: 32,
      longitudeBands: 32
      });

    Properties

    blendIndices: undefined | number[]

    Blend indices.

    blendWeights: undefined | number[]

    Blend weights.

    colors: undefined | number[]

    Colors.

    Methods