kevzettler Posted June 12, 2016 Share Posted June 12, 2016 I have a scene where I create a Sphere. I then use BABYLON.SceneLoader.Append to import a skeleton. I attach the sphere to one of the skeleton bones and it disappears. You can see this happening here: http://kevzettler.com/robotbones/ I can provide the full source if that would help. The source of the scene looks like: const canvas = document.getElementById('render-container'); const engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3(0, 1, 0); // This creates and positions a free camera var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene); camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, false); // This creates a light, aiming 0,1,0 - to the sky. var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = .5; // Let's try our built-in 'sphere' shape. Params: name, subdivisions, size, scene var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 1, scene); sphere.position.y = 1; var skeletonPlaceholder = new BABYLON.AbstractMesh('', scene); function skeletonLoadHandler(scene){ var skeleton = scene.skeletons[0]; var viewer = new BABYLON.Debug.SkeletonViewer(skeleton, skeletonPlaceholder, scene); viewer.isEnabled = true; //enables skeleton animation sphere.attachToBone(skeleton.bones[1], skeletonPlaceholder); var anim = skeleton.beginAnimation("ArmatureAction.001", true, 1); } function loadProgressHandler(progress){ console.log("loading: ", progress); } engine.runRenderLoop(() => { scene.render(); }); window.addEventListener("resize", () => { engine.resize(); }); BABYLON.SceneLoader.ShowLoadingScreen = false; BABYLON.SceneLoader.Append("./assets/models/mechsniper/babylon/", "combined.babylon", scene, skeletonLoadHandler, loadProgressHandler) Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 12, 2016 Share Posted June 12, 2016 @kevzettler - I believe I and others recently tried to assist you in a seperate post concerning a similar issue with object visability when parenting objects to bones in Blender. For myself (and most likely others,) it is important to know your pipeline prior to BJS, and how you generated your skeleton (bones.) As we discussed previously, this is often an issue due to how the skelton bones are identified in any application. However, in looking at the code you provided, the process you use in parenting your object to a bone inside of an array may be the issue. I don't have the time at this moment to test this, but perhaps someone else on the forum may be able to see the problem with the limited code you provided. Otherwise, more info is the key to solving your problem, and if you build a playground scene, this most likely could be solved without delay. Of course, there's always @Wingnut - who obviously hasn't read this post yet - as I'm certain we'd already see him testing a new playground scene using your code. Cheers, DB Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 13, 2016 Share Posted June 13, 2016 http://playground.babylonjs.com/#2F6AQS#0 Hey, I'll make a playground for a friend of BJS sometimes, what the heck. No time to troubleshoot this at the moment, but I see one error. In the console: WebGL: drawElements: bound element array buffer is too small for given count and offset. That could indicate a situation in the exporter, I suppose. JSON lint says it's valid JSON.. I'll keep thinking, but I'm scared of skeletons. Hopefully, the Monday crew will be able to beat this issue into submission. Help wanted. @kevzettler - You did no hand-editing of the .babylon file after export from Blender 2.76 (sub 0), right? (Folks rarely do such edits, but I thought I would ask just the same.) Ok, talk soon. Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 14, 2016 Author Share Posted June 14, 2016 Quote You did no hand-editing of the .babylon file after export from Blender 2.76 (sub 0), right? (Folks rarely do such edits, but I thought I would ask just the same.) Correct I did not. I've open sourced the sample project:https://github.com/kevzettler/robotbones you can see the babylon json file herehttps://github.com/kevzettler/robotbones/blob/master/assets/models/mechsniper/babylon/combined.babylon The blender file is also in the /assets directory. The blender file has 2 layers. layer 1 is the armature, layer 2 is the meshes. the meshes are rigged and animated to the armature. When I export I only export layer 1. Quote Link to comment Share on other sites More sharing options...
adam Posted June 14, 2016 Share Posted June 14, 2016 http://playground.babylonjs.com/#2F6AQS#1 gryff 1 Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 14, 2016 Author Share Posted June 14, 2016 @adam That works. I was able to achieve that separately. I didn't want to import the other meshes from the blender scene only the skeleton. I guess worst case scenario I can import them and manually hide or remove but wondering why the first approach doesn't work? Quote Link to comment Share on other sites More sharing options...
adam Posted June 14, 2016 Share Posted June 14, 2016 I just compared the two combined.bablylon files with WinMerge and they are not the same. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.