Based on Cloner System extension https://github.com/androdlang/Extensions/tree/master/ClonerSystem by https://github.com/androdlang
More info and docs here - https://doc.babylonjs.com/communityExtensions/clonerSystem
Definitions:
The demo with all cloners (animated) - https://clonersystem.babylonpress.org/ (the default example scene for this repo)
The demo with all cloners (static) - https://babylonpress.org/cloner/
Extensive old version documentation - https://doc.babylonjs.com/communityExtensions/clonerSystem
https://playground.babylonjs.com/#1MYQ3T#47
https://playground.babylonjs.com/#1WRUHY#2
https://www.babylonjs-playground.com/#1NYYEQ#5
https://www.babylonjs-playground.com/#1NYYEQ#6
https://www.babylonjs-playground.com/#1NYYEQ#7
https://playground.babylonjs.com/#JWETXJ#0
npm i bp-cloner
Import needed Cloners like
import { RandomEffector } from "bp-cloner";
import { MatrixCloner } from "bp-cloner"
Then use like
const mc = new MatrixCloner([capsule, box, sphere], scene, {
mcount: { x: 5, y: 5, z: 5 },
});
mc.root!.position = new Vector3(-10, 0, 15);
const rr = new RandomEffector();
rr.strength = 1;
rr.position = { x: 2, y: 0, z: 2 };
rr.rotation = { x: 70, y: 30, z: 0 };
mc.addEffector(rr, 1);
Or if you use <script> tags see UMD and ESM variants here - https://www.jsdelivr.com/package/npm/bp-cloner?tab=files
This is a Babylon.js project using typescript, latest babylon.js es6 core module, vite 6.
To run the basic Cloner System scene (with some animations):
npm install to install the needed dependencies.npm run dev to display the test page.npm run test , for coverage npm run test:coveragenpm run build (only Cloner folder to dist/).To generate documentation use
npx typedoc --entryPointStrategy Expand src/Cloner --exclude "src/Cloner/index.ts"