Adding object relatively to mesh

Hello :slight_smile:
I’m working on 's code

I added cone mesh to scene by clicking button.
and it indeed added to scene, but added cone is shown when I zoom - out.
I tried to changed z index of cone object but it dosen’t work (tried other x, y, but not working)
what I want to do is that I want to generate cone right above of basic mesh when generated on init function.

on example,
basic mesh is generated by below code.
they didn’t put any work on mesh’s position, so, it should be 0,0,0…?

var geometry = new THREE.TorusKnotBufferGeometry( 3, 1, 256, 32 );
			var material = new THREE.MeshStandardMaterial( { color: 0x6083c2 } );
            mesh = new THREE.Mesh( geometry, material );
            scene.add( mesh );

below is the code that I generate cone to scene.

function generating(){
            const RADIUS = 40
            const geometrys = new THREE.OctahedronGeometry(RADIUS, 0);
				var object = new THREE.Mesh( geometrys, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
				object.position.x = mesh.position.x;
                object.position.y = mesh.position.y;
                object.position.z = mesh.position.z;
				object.castShadow = true;
				object.receiveShadow = true;
				scene.add( object );

Have a look at this example: Edit fiddle - JSFiddle - Code Playground

It’s much easier to position an object relative to another one if you create a child-parent relationship. So the cone is added as a child to the mesh.