1
votes

When I load jSON Object to the scene using ObjectLoader, I can't assign DragControls to them. But a mesh is added to the Loader, I can assign dragcontrollers.

I used this source code for my projects https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_spline_editor.html

var loader = new THREE.ObjectLoader();
loader.load( model_url , function ( object ) {
    splineHelperObjects.push( object );
    splinePointsLength++;
    scene.add( object );
});
1

1 Answers

2
votes

I finally figured this out. Object3D have to to included into a mesh. Then it can be added to helper objects.

var loader = new THREE.ObjectLoader();
loader.load( model_url , function ( object ) {

   var cylBleu = new THREE.MeshNormalMaterial( { transparent: true, opacity: 0 });
   var newMesh = new THREE.Mesh( object.children[0].geometry, cylBleu );`

   newMesh.add(object);
   splineHelperObjects.push( object );
   splinePointsLength++;
   scene.add( object );
});