How to use the three.Object3D 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 vaalentin / 2015 / app / src / js / objects3D / RocksObject3D.js View on Github external
function Rocks () {
  var group = new THREE.Object3D();

  var sphere = this.getSphere(); 
  group.add(sphere);

  var light = this.getLight();
  group.add(light);

  // rocks
  var rocksMaterial = new THREE.MeshLambertMaterial({
    color: '#0a0a0a',
    side: THREE.DoubleSide,
    shading: THREE.FlatShading
  });

  var fromColor = new THREE.Color('#0a0a0a');
  var toColor = new THREE.Color('#ffffff');
github ianpaschal / polyply / src-old / core / Gizmo.js View on Github external
this.init = function() {
		Three.Object3D.call( this );
		this.handles = new Three.Object3D();
		this.pickers = new Three.Object3D();
		this.planes = new Three.Object3D();
		this.add( this.handles ); /*lines*/
		this.add( this.pickers );
		this.add( this.planes );

		function createHandle( axis ) {
			let handle = new Three.Object3D();
			handle.name = "handle";
			let color = new Three.Color();
			switch ( axis ){
				case "x": color.set( 0xff0000 ); break;
				case "y": color.set( 0x00ff00 ); break;
				case "z": color.set( 0x0000ff ); break;
			}
			// Line:
github lucascassiano / reViz3d / reViz3d-R1 / src / utilities / TransformControls.js View on Github external
this.init = function () {
    
                THREE.Object3D.call(this);
    
                this.handles = new THREE.Object3D();
                this.pickers = new THREE.Object3D();
                this.planes = new THREE.Object3D();
    
                this.add(this.handles);
                this.add(this.pickers);
                this.add(this.planes);
    
                //// PLANES
    
                var planeGeometry = new THREE.PlaneBufferGeometry(50, 50, 2, 2);
                var planeMaterial = new THREE.MeshBasicMaterial({ visible: false, side: THREE.DoubleSide });
    
                var planes = {
                    "XY": new THREE.Mesh(planeGeometry, planeMaterial),
                    "YZ": new THREE.Mesh(planeGeometry, planeMaterial),
                    "XZ": new THREE.Mesh(planeGeometry, planeMaterial),
github cvdlab / react-planner / demo / src / catalog / items / chairdesk / planner-element.jsx View on Github external
function makeWheelMinLOD(){

  let ArmrestGeometry = new Three.CylinderGeometry( 0.027 , 0.02 , 0.3 , 8, 8 );
  let SupportGeometry = new Three.CylinderGeometry( 0.02 , 0.01 , 0.02 , 8, 8 );
  let PivotGeometry = new Three.CylinderGeometry( 0.008 , 0.008 , 0.01 , 8, 8 );
  let SupportGeometryStart = new Three.SphereGeometry( 0.02 , 8 , 8 );
  let WheelGeometry = new Three.CylinderGeometry( 0.025 , 0.025 , 0.05 , 8, 8 );
  let InsideWheelGeometry = new Three.CylinderGeometry( 0.02 , 0.02 , 0.051 , 8, 8 );
  let armrest = new Three.Mesh( ArmrestGeometry , metalGrey );
  let support = new Three.Mesh( SupportGeometry , metalGrey );
  let pivot = new Three.Mesh( PivotGeometry , grey );
  let SupportStart = new Three.Mesh( SupportGeometryStart , metalGrey );
  let Wheel = new Three.Mesh( WheelGeometry , black );
  let InsideWheel = new Three.Mesh( InsideWheelGeometry , metalGrey );
  let Armrest1 = new Three.Object3D();
  let Armrest2 = new Three.Object3D();
  armrest.rotation.z = Math.PI*80/180;
  armrest.position.x = 0.01 + 0.15;
  Armrest1.rotation.z =-Math.PI*80/180;
  Armrest1.position.y =-Math.sin(Math.PI*80/180)*0.15;
  support.position.y =-0.01;
  pivot.position.y =-0.01 - 0.005;
  Wheel.rotation.x = Math.PI/2;
  Wheel.position.y =-0.005 -0.02;
  Wheel.add(InsideWheel);
  pivot.add(Wheel);
  support.add(pivot);
  Armrest1.add(support);
  Armrest1.add(SupportStart);
  armrest.add(Armrest1);
  Armrest2.add(armrest);
github NUbots / NUsight2 / src / client / components / localisation / darwin_robot / left_arm / view_model.ts View on Github external
get leftArm() {
    const leftArm = new Object3D()
    leftArm.add(this.leftShoulder)
    return leftArm
  }
github shinseed / BIMServer-NodeJs / BIMServerSrc / components / threeView / util.js View on Github external
updateAssets(objs) {
        this.objs2Load = [];
        this.loadCounter = 0;
        this.processing = true;
        if (Boolean(objs)) {

            var obj2Load;
            var pivot;
            var errors = '';

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

                obj2Load = objs[i];
                if (!this.allAssets.hasOwnProperty(obj2Load.name)) {

                    pivot = new THREE.Object3D();
                    pivot.position.set(obj2Load.pos.x, obj2Load.pos.y, obj2Load.pos.z);
                    pivot.scale.set(obj2Load.scale, obj2Load.scale, obj2Load.scale);
                    pivot.name = obj2Load.name;
                    let radian = Math.PI / 180 * obj2Load.rotate.angle;
                    let axis = new THREE.Vector3(obj2Load.rotate.x, obj2Load.rotate.y, obj2Load.rotate.z);

                    pivot.rotateOnAxis(axis, radian);
                    obj2Load.pivot = pivot;
                    this.objs2Load.push(obj2Load);
                    this.allAssets[obj2Load.name] = obj2Load;

                } else {

                    errors += obj2Load.name + ' ';

                }
github boscoh / jolecule / src / representation.js View on Github external
constructor (soup, radius) {
    this.soup = soup
    this.displayObj = new THREE.Object3D()
    this.pickingObj = new THREE.Object3D()
    this.radius = radius
    this.build()
  }
github rapyuta-robotics / amphion / src / viz / Odometry.js View on Github external
getObject() {
    const { type } = this.options;
    switch (type) {
      case ODOMETRY_OBJECT_TYPES.arrow:
        return new Arrow();
      case ODOMETRY_OBJECT_TYPES.axes:
        return new Axes();
    }

    return new Object3D();
  }
github ApolloAuto / apollo / modules / dreamview / frontend / src / renderer / decision.js View on Github external
getFence(type) {
        let fence = null;
        let icon = null;
        const marker = new THREE.Object3D();
        switch (type) {
            case 'STOP':
                fence = drawImage(fenceObjectStop, 11.625, 3, 0, 1.5, 0);
                marker.add(fence);
                icon = drawImage(iconObjectStop, 1, 1, 3, 3.6, 0);
                marker.add(icon);
                break;
            case 'FOLLOW':
                fence = drawImage(fenceObjectFollow, 11.625, 3, 0, 1.5, 0);
                marker.add(fence);
                icon = drawImage(iconObjectFollow, 1, 1, 3, 3.6, 0);
                marker.add(icon);
                break;
            case 'YIELD':
                fence = drawImage(fenceObjectYield, 11.625, 3, 0, 1.5, 0);
                marker.add(fence);
github Boodo-FE / SkyNote / src / objects / sky / star.js View on Github external
stars(){
    this.geometry = new THREE.CylinderGeometry(0.01, 1.6, 5, 18, 10)
    let nBlocs = 8+Math.floor(Math.random()*3);
    for(let j=1; j