How to use the three.Group function in three

To help you get started, we’ve selected a few three examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bs-community / skinview3d / js / skinview3d.module.js View on Github external
addVertices(rightArm2Box, toSkinVertices(44, 32, 47, 36), toSkinVertices(47, 32, 50, 36), toSkinVertices(40, 36, 44, 48), toSkinVertices(44, 36, 47, 48), toSkinVertices(47, 36, 51, 48), toSkinVertices(51, 36, 54, 48));
		} else {
			addVertices(rightArm2Box, toSkinVertices(44, 32, 48, 36), toSkinVertices(48, 32, 52, 36), toSkinVertices(40, 36, 44, 48), toSkinVertices(44, 36, 48, 48), toSkinVertices(48, 36, 52, 48), toSkinVertices(52, 36, 56, 48));
		}
		var rightArm2Mesh = new Mesh(rightArm2Box, layer2Material);
		rightArm2Mesh.renderOrder = 1;
		rightArmPivot.add(rightArm2Mesh);

		rightArmPivot.position.y = -6;
		_this.rightArm.add(rightArmPivot);
		_this.rightArm.position.y = -4;
		_this.rightArm.position.x = slim ? -5.5 : -6;
		_this.add(_this.rightArm);

		// Left Arm
		_this.leftArm = new Group();
		var leftArmPivot = new Group();

		var leftArmBox = new BoxGeometry((slim ? 3 : 4) - esp, 12 - esp, 4 - esp, 0, 0, 0);
		if (slim) {
			addVertices(leftArmBox, toSkinVertices(36, 48, 39, 52), toSkinVertices(39, 48, 42, 52), toSkinVertices(32, 52, 36, 64), toSkinVertices(36, 52, 39, 64), toSkinVertices(39, 52, 43, 64), toSkinVertices(43, 52, 46, 64));
		} else {
			addVertices(leftArmBox, toSkinVertices(36, 48, 40, 52), toSkinVertices(40, 48, 44, 52), toSkinVertices(32, 52, 36, 64), toSkinVertices(36, 52, 40, 64), toSkinVertices(40, 52, 44, 64), toSkinVertices(44, 52, 48, 64));
		}
		var leftArmMesh = new Mesh(leftArmBox, layer1Material);
		leftArmPivot.add(leftArmMesh);

		var leftArm2Box = new BoxGeometry((slim ? 3.375 : 4.5) - esp, 13.5 - esp, 4.5 - esp, 0, 0, 0);
		if (slim) {
			addVertices(leftArm2Box, toSkinVertices(52, 48, 55, 52), toSkinVertices(55, 48, 58, 52), toSkinVertices(48, 52, 52, 64), toSkinVertices(52, 52, 55, 64), toSkinVertices(55, 52, 59, 64), toSkinVertices(59, 52, 62, 64));
		} else {
			addVertices(leftArm2Box, toSkinVertices(52, 48, 56, 52), toSkinVertices(56, 48, 60, 52), toSkinVertices(48, 52, 52, 64), toSkinVertices(52, 52, 56, 64), toSkinVertices(56, 52, 60, 64), toSkinVertices(60, 52, 64, 64));
github facebook / react-360 / React360 / js / Loaders / ObjModelLoader.js View on Github external
_updateMeshes(previousGroup?: Group) {
    if (!this._objState) {
      return;
    }
    const fallbackMaterial = this._lit
      ? this._litMaterial
      : this._unlitMaterial;
    const group = previousGroup || new Group();
    let index = 0;
    this._objState.objects.forEach(obj => {
      const geometry = obj.geometry;
      if (geometry.position.length < 1) {
        return;
      }
      const materials = obj.materials
        // Eliminate materials that don't have any faces
        .filter(m => m.startGroup < m.endGroup || m.endGroup < 0);
      const bufferGeometry = previousGroup ? null : new BufferGeometry();
      if (bufferGeometry) {
        bufferGeometry.addAttribute(
          'position',
          new BufferAttribute(new Float32Array(geometry.position), 3),
        );
        bufferGeometry.setIndex(
github rapyuta-robotics / amphion / build / amphion.module.js View on Github external
constructor(options = {}) {
    super();
    this.vizWrapper = new Group$1();
    this.add(this.vizWrapper);

    this.stats = new Stats();
    this.stats.showPanel(0);

    this.initLights();
    this.initGrid();
    this.updateOptions(options);
  }
github nus-mtp / cubist / src / webapp / render / OBJMTLLoader.js View on Github external
parse(data, mtllibCallback) {
    let faceOffset = 0;
    const group = new THREE.Group();
    let object = group;

    let geometry = new THREE.Geometry();
    let material = new THREE.MeshLambertMaterial();
    let mesh = new THREE.Mesh(geometry, material);

    let vertices = [];
    const normals = [];
    const uvs = [];

    function vector(x, y, z) {
      return new THREE.Vector3(x, y, z);
    }

    function uv(u, v) {
      return new THREE.Vector2(u, v);
github tweedegolf / collada2json / js / lib / collada_loader.js View on Github external
for ( var i = 0, l = instanceNodes.length; i < l; i ++ ) {

				objects.push( getNode( instanceNodes[ i ] ).clone() );

			}

			var object;

			if ( nodes.length === 0 && objects.length === 1 ) {

				object = objects[ 0 ];

			} else {

				object = ( type === 'JOINT' ) ? new THREE.Bone() : new THREE.Group();

				for ( var i = 0; i < objects.length; i ++ ) {

					object.add( objects[ i ] );

				}

			}

			if ( object.name === '' ) {

				object.name = ( type === 'JOINT' ) ? data.sid : data.name;

			}

			object.matrix.copy( matrix );
github shinseed / BIMServer-NodeJs / BIMServerSrc / components / threeView / OBJLoader2.js View on Github external
MeshCreator.prototype.setSceneGraphBaseNode = function ( sceneGraphBaseNode ) {
			this.sceneGraphBaseNode = Validator.verifyInput( sceneGraphBaseNode, this.sceneGraphBaseNode );
			this.sceneGraphBaseNode = Validator.verifyInput( this.sceneGraphBaseNode, new THREE.Group() );
		};
github Space-Explorers / Galacticode / client / components / threejs / gameplay.js View on Github external
scene.add(challenge2)
  challenges.push(challenge2)

  const challenge3 = addChallenge(3, -100, 2, -20)
  scene.add(challenge3)
  challenges.push(challenge3)

  const challenge4 = addChallenge(10, 0, 2, -20)
  scene.add(challenge4)
  challenges.push(challenge4)

  const challenge5 = addChallenge(5, 100, 2, -71)
  scene.add(challenge5)
  challenges.push(challenge5)

  const stars = new THREE.Group()
  const geometry = new THREE.SphereGeometry(10, 3, 3)
  const material = new THREE.MeshBasicMaterial({
    color: 0xA9D9E5,
    wireframe: false,
  })

  const radius = 2500
  const separation = 3

  for (let i = 0 + separation; i <= 180 - separation; i += separation) {
    const radian1 = i * Math.PI / 180

    for (let j = 0; j < 360; j += separation) {
      const radian2 = j * Math.PI / 180

      const cube = new THREE.Mesh(geometry, material)
github Space-Explorers / Galacticode / client / components / threejs / planetBackground.js View on Github external
function drawParticles() {
    particles = new THREE.Group();
    scene.add(particles);
    const geometry = new THREE.TetrahedronGeometry(2, 0);

    for (let i = 0; i < 500; i++) {
      const material = new THREE.MeshPhongMaterial({
        color: 0x9CE7EA,
        shading: THREE.FlatShading
      });
      const mesh = new THREE.Mesh(geometry, material);
      mesh.position.set((Math.random() - 0.5) * 1000,
        (Math.random() - 0.5) * 1000,
        (Math.random() - 0.5) * 1000);
      mesh.updateMatrix();
      mesh.matrixAutoUpdate = false;
      particles.add(mesh);
    }
github madebywild / konterball / src / javascripts / hud / message.js View on Github external
constructor(scene, config, font, antique, emitter) {
    this.emitter = emitter;
    this.scene = scene;
    this.font = font;
    this.config = config;
    this.wrap = wrap(CHAR_LIMIT);
    this.buttons = {};
    this.antique = antique;
    this.messageGroup = new Group();
    this.intersectedButton = null;
    this.scene.add(this.messageGroup);
    this.setMessage('waiting');
    this.showMessage();
    this.crazyGroup = new Group();
    this.scene.add(this.crazyGroup);
    this.buttons[config.rainbowText] = new Button(this.crazyGroup, this.font, config.rainbowText, 0, 2, this.emitter, 0.7 * 100, 0.2 * 100, 0.01 * 100, 0.04 * 100);
    this.buttons[config.rainbowText].buttonGroup.position.z = 200;
    this.buttons[config.rainbowText].buttonGroup.rotation.y = Math.PI;
  }