- BabylonJS Tutorial
- BabylonJS - Home
- BabylonJS - Introduction
- BabylonJS - Environment Setup
- BabylonJS - Overview
- BabylonJS - Basic Elements
- BabylonJS - Materials
- BabylonJS - Animations
- BabylonJS - Cameras
- BabylonJS - Lights
- BabylonJS - Parametric Shapes
- BabylonJS - Mesh
- VectorPosition and Rotation
- BabylonJS - Decals
- BabylonJS - Curve3
- BabylonJS - Dynamic Texture
- BabylonJS - Parallax Mapping
- BabylonJS - Lens Flares
- BabylonJS - Create ScreenShot
- BabylonJS - Reflection Probes
- Standard Rendering Pipeline
- BabylonJS - ShaderMaterial
- BabylonJS - Bones and Skeletons
- BabylonJS - Physics Engine
- BabylonJS - Playing Sounds & Music
- BabylonJS Useful Resources
- BabylonJS - Quick Guide
- BabylonJS - Useful Resources
- BabylonJS - Discussion
BabylonJS - Cone
This is one of the shapes used with the MeshBuilder.
Syntax
Following is the syntax to create a Cone −
var cone = BABYLON.MeshBuilder.CreateCylinder("cone", {height,diameterTop: 0, diameterBottom, diameter, tessellation: 4, subdivisions, faceColors, faceUV, arc, updatable}, scene);
CreateCylinder is used to create both cylinder and cone and the same is controlled by the diameterTop property. If set to 0, it is a cone; and if it is greater than 0, it is a cylinder.
Parameters
Consider the following parameters to create a cone −
Height − Height given to the cylinder.
DiameterTop − Diameter given to the top cap. If 0, it will be cone. It will overwrite the diameter property.
DiameterBottom − Diameter for the bottom. It has to be greater than 0. It overwrites the diameter property.
Diameter − Diameter for the top and bottom.
Tessellation − Number of radial sides.
Subdivisions − Number of rings.
FaceColors − Array of 3 Color4, 0 : bottom cap, 1 : cylinder tube, 2 : top cap
FaceUV − Array of 3 Vector4, 0 : bottom cap, 1 : cylinder tube, 2 : top cap
Arc − Ratio of circumference between 0 and 1
Updatable − By default, this is set to false. If it needs to be updated during morphing, you can set it to true.