Jump to content

3ds Max multiple animations


spritefire
 Share

Recommended Posts

Heyas :)

Where would I find info about exporting a 3ds max animation where I can import it into blender and press a key for a walk animation, a different key for a run animation and another key for a jump animation?

What would be the best practice, should I create the different animations at different frames and then loop through the different frames when key is pressed? or is there a different way?

Link to comment
Share on other sites

hmm this doesn't seem to be working. 
no matter what frames I place in the code it cycles through all of the frames. 

ie I have:
scene.beginAnimation(scene.manModel.skeletons, 20, 40, true, 1.0);

and it loops from 0 frame to 120 frame.

Actually even if I don't have any code with beginAnimation and just import the model it cycles through all animations :/

Link to comment
Share on other sites

maybe the issue is something else. The mesh is named human in 3ds max and when i export and debug I can see it named human, but it doesn't appear the name is linking to the mesh?

It doesn't scale, change position or do the animations in the frames. It does load though, and even if I don't tell it what mesh to import.. :/

Here is my code:

 

        var canvas = document.getElementById("renderCanvas");        var engine = new BABYLON.Engine(canvas, true);        var createScene = function () {            var scene = new BABYLON.Scene(engine);            var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(10, 10, 10), scene);            var light0 = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 1, 0), scene);            light0.diffuse = new BABYLON.Color3(1, 1, 1);            light0.specular = new BABYLON.Color3(1, 1, 1);            light0.groundColor = new BABYLON.Color3(0, 0, 0);            var myCamera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 525, -500), scene);            myCamera.rotation = new BABYLON.Vector3(Math.PI/12,Math.PI*2,0);            scene.activeCamera = myCamera;                        BABYLON.SceneLoader.ImportMesh("human", "", "man.babylon", scene, function (newMeshes, particleSystems, skeleton) {                    scene.clearColor = new BABYLON.Color4(0,0,0,0);                                        scene.manModel = scene.getMeshByName("human");                                        scene.manModel.position = new BABYLON.Vector3(0, 0, 0);                    scene.manModel.scaling = new BABYLON.vector3(0.5, 0.5, 0.5);                                        scene.beginAnimation(scene.manModel.skeleton[0], 20, 40, true, 1.0);                    //scene.manModel.materialmesh;            });                        return scene;        }                var scene = createScene();        engine.runRenderLoop(function () {            scene.render();        });        window.addEventListener("resize", function () { engine.resize(); }); // Resize engine 
Link to comment
Share on other sites

That's the example I used. I've also switched the code to the code you have written and still the same result. 
It's strange because it should work which is why I am stumped. 

Nothing seems to be affecting the model, rotation, position, scale etc also don't work. 



 

Link to comment
Share on other sites

Try this:
 

See line 3, 4 and 11

BABYLON.SceneLoader.ImportMesh("human", "", "man.babylon", scene, function (newMeshes, particleSystems, skeleton) {		var mesh = newMeshes[0];	var skeleton = skeleton[0];		scene.clearColor = new BABYLON.Color4(0,0,0,0);	mesh.position = new BABYLON.Vector3(0, 0, 0);	mesh.scaling = new BABYLON.Vector3(0.5, 0.5, 0.5);	scene.beginAnimation(skeleton, 20, 40, true, 1.0);});
Link to comment
Share on other sites

still no luck. 
I've been clearing cache as well just to insure it hasn't been that. 

I'm using the latest exporter but have also tried older versions and still the same results. 
I think maybe its to do with the layers and naming in 3ds max but it all looks fine to me.

 

Link to comment
Share on other sites

The problem comes from your model can be. the code works for me.

 

You said console.log (skeleton) you have error?

 

Oh. I just saw the error. Try (I remove the Name of ImportMesh)

BABYLON.SceneLoader.ImportMesh("", "", "man.babylon", scene, function (newMeshes, particleSystems, skeleton) {		var mesh = newMeshes[0];	var skeleton = skeleton[0];		scene.clearColor = new BABYLON.Color4(0,0,0,0);	mesh.position = new BABYLON.Vector3(0, 0, 0);	mesh.scaling = new BABYLON.Vector3(0.5, 0.5, 0.5);	scene.beginAnimation(skeleton, 20, 40, true, 1.0);        console.log(skeleton);});
Link to comment
Share on other sites

Yes it was the model. I removed the edit poly modifiers I had on the human mesh and things started working better. 
I have now exported the model and used the new code you have supplied and everything is working perfectly! :D

So it appears exporting meshes that have a skin modifer with animation/rigging attached and also an edit poly modifier is a no no. 

Thanks! :)



 

Link to comment
Share on other sites

That is strange because I had tried it without the name before I had removed the edit poly modifier and still was unable to get it to work. 
Maybe it was what I had done in the edit poly and where I had placed it (had created it above the skin modifier and then dragged it below it). 

I still have the archive of the file that has it set up that way. I will do some testing on it (ie export that model with the code that is working with the updated model) and see what the results are. 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...