UNPKG

bp-cloner

Version:

More info and explanations here - https://doc.babylonjs.com/communityExtensions/clonerSystem

78 lines (77 loc) 3.05 kB
import { Cloner, CMesh } from './core'; import { Scene } from '@babylonjs/core/scene'; import { Mesh } from '@babylonjs/core/Meshes/'; import { Vector3 } from '@babylonjs/core/Maths/math.vector'; /** * The RadialCloner distributes given meshes in a radial manner. If more than one meshes are provided, then the clones will be placed alternatively. * Several parameters controls the position, angle, type and orientation of the clones. * @param mesh mesh to clone * @param scene * @param options all optional: count, offset, radius, startangle, endangle, useInstances, plane *@param count The number of instances/clones. Default 3. * @param radius The radius in world units. Default 3. * @param align Flag if clones are aligned against the middle position of the cloner. Default true * @param startangle The angle in degrees. Default 0. * @param endangle The angle in degrees. Default 360. * @param offset The angle in degrees. * @param useInstances Flag if clones should be technical "clones" or "instances". Default true = instances. * @param plane The object {x,y,z} describing the cloners orientation. Default { x: 1, y: 0, z: 1 }. * @param isPickable Flag true if Cloner meshes should be pickable. Default false. */ export declare class RadialCloner extends Cloner { static instance_nr: number; private _instance_nr; private _useInstances; private _radius; private _plane; private _startangle; private _endangle; private _offset; private _align; private isPickable; constructor(mesh: Array<Mesh>, scene: Scene, { count, offset, radius, align, startangle, endangle, useInstances, plane, isPickable, }?: { count?: number | undefined; offset?: number | undefined; radius?: number | undefined; align?: boolean | undefined; startangle?: number | undefined; endangle?: number | undefined; useInstances?: boolean | undefined; plane?: { x: number; y: number; z: number; } | undefined; isPickable?: boolean | undefined; }); createClone(parent: CMesh): Mesh | null; createClones(start?: number): void; private calcRot; private calcSize; private calcPos; update(): void; /** * Deletes all Cloner's children and disposes the root Node. */ delete(): void; recalc(): void; set count(scnt: number | undefined); get count(): number | undefined; set offset(off: number); get offset(): number; /** * Gets Cloner's root - an invisible mesh, the anchor and parent of all generated instances/clones. * Transforming this root affects all underlying clones (childs) at once. */ get root(): Mesh | null; set radius(r: number); get radius(): number; set align(a: boolean); get align(): boolean; set startangle(sa: number); get startangle(): number; set endangle(se: number); get endangle(): number; set plane(p: Vector3); setScaling(ix: number, sc: Vector3): void; }