# ConeGeometry

Class · extends [`ConeBaseGeometry`](https://api.playcanvas.com/engine/classes/ConeBaseGeometry.md) · category: Graphics

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/scene/geometry/cone-geometry.js#L33

A procedural cone-shaped geometry.

Typically, you would:

1. Create a ConeGeometry instance.
2. Generate a [Mesh](https://api.playcanvas.com/engine/classes/Mesh.md) from the geometry.
3. Create a [MeshInstance](https://api.playcanvas.com/engine/classes/MeshInstance.md) referencing the mesh.
4. Create an [Entity](https://api.playcanvas.com/engine/classes/Entity.md) with a [RenderComponent](https://api.playcanvas.com/engine/classes/RenderComponent.md) and assign the [MeshInstance](https://api.playcanvas.com/engine/classes/MeshInstance.md) to it.
5. Add the entity to the [Scene](https://api.playcanvas.com/engine/classes/Scene.md).

```javascript
// Create a mesh instance
const geometry = new ConeGeometry();
const mesh = Mesh.fromGeometry(app.graphicsDevice, geometry);
const material = new StandardMaterial();
const meshInstance = new MeshInstance(mesh, material);

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

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

## Constructors

### constructor

```ts
new ConeGeometry(opts?: object)
```

Create a new ConeGeometry instance.

By default, the constructor creates a cone standing vertically centered on the XZ-plane with
a base radius of 0.5, a height of 1.0, 5 height segments and 18 cap segments. The cone is
created with UVs in the range of 0 to 1.

**Parameters**

- `opts` (`object`, optional, default `{}`): Options object.
    - `opts.baseRadius` (`number`, optional): The base radius of the cone. Defaults to 0.5.
    - `opts.calculateTangents` (`boolean`, optional): Generate tangent information. Defaults to false.
    - `opts.capSegments` (`number`, optional): The number of divisions around the tubular body of the
      cone. Defaults to 18.
    - `opts.height` (`number`, optional): The length of the body of the cone. Defaults to 1.
    - `opts.heightSegments` (`number`, optional): The number of divisions along the length of the cone.
      Defaults to 5.
    - `opts.peakRadius` (`number`, optional): The peak radius of the cone. Defaults to 0.

**Example**

```ts
const geometry = new ConeGeometry({
    baseRadius: 1,
    height: 2,
    heightSegments: 2,
    capSegments: 20
});
```

## Inherited from [ConeBaseGeometry](https://api.playcanvas.com/engine/classes/ConeBaseGeometry.md)

- `blendIndices: ArrayLike<number> | undefined`
- `blendWeights: ArrayLike<number> | undefined`
- `colors: ArrayLike<number> | undefined`
- `tangents: ArrayLike<number> | undefined`
- `calculateNormals(): void`
- `calculateTangents(): void`
