gkjohnson / urdf-loaders

URDF Loaders for Unity and THREE.js with example ATHLETE URDF Files open sourced from NASA JPL
https://gkjohnson.github.io/urdf-loaders/javascript/example/bundle/index.html
Apache License 2.0
471 stars 122 forks source link

No visual, with no errors #250

Closed nicholscrawford closed 1 year ago

nicholscrawford commented 1 year ago

Trying to load an iiwa URDF, with .obj files. It seems like I need to provide my own loader callback, which I did like this:

loader.loadMeshCb = function( path, manager, onComplete ) {

        const objLoader = new OBJLoader( manager );
        objLoader.load(
            path,
            result => {
                onComplete( result.scene );
            },
            undefined,
            err => {
                // try to load again, notify user, etc
                onComplete( null, err );  
            }
        );
    };

And otherwise everything else is basically copied exactly from the example. The only other thing I noticed that was weird was the bounding box seems to have infinite lengths, but even setting the robot position to 0,0,0 didn't seem to fix it. That seems to suggest the geometry is not loading, but I'm not getting any errors. Is this a proper callback? Is .obj built in?

gkjohnson commented 1 year ago
onComplete( result.scene );

OBJLoader returns an Object3D - not an object with a "scene" field. See the OBJLoader docs. I would make sure you're using the mesh loader correctly by using some log statements first.

nicholscrawford commented 1 year ago

Oh thank you!

nicholscrawford commented 1 year ago

Resolved by removing .scene. Thanks for the tips, I'm new to js.