UNPKG

1.36 kBTypeScriptView Raw
1import { Object3D, Object3DEventMap } from "../core/Object3D.js";
2
3/**
4 * Its purpose is to make working with groups of objects syntactically clearer.
5 * @remarks This is almost identical to an {@link Object3D | Object3D}
6 * @example
7 * ```typescript
8 * const geometry = new THREE.BoxGeometry(1, 1, 1);
9 * const material = new THREE.MeshBasicMaterial({
10 * color: 0x00ff00
11 * });
12 * const cubeA = new THREE.Mesh(geometry, material);
13 * cubeA.position.set(100, 100, 0);
14 * const cubeB = new THREE.Mesh(geometry, material);
15 * cubeB.position.set(-100, -100, 0);
16 * //create a {@link Group} and add the two cubes
17 * //These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
18 * group.add(cubeA);
19 * group.add(cubeB);
20 * scene.add(group);
21 * ```
22 * @see {@link https://threejs.org/docs/index.html#api/en/objects/Group | Official Documentation}
23 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Group.js | Source}
24 */
25export class Group<TEventMap extends Object3DEventMap = Object3DEventMap> extends Object3D<TEventMap> {
26 /**
27 * Creates a new {@link Group}.
28 */
29 constructor();
30
31 /**
32 * Read-only flag to check if a given object is of type {@link Group}.
33 * @remarks This is a _constant_ value
34 * @defaultValue `true`
35 */
36 readonly isGroup: true;
37}