Jump to content

Playing multiple animations


Gugis
 Share

Recommended Posts

  • 3 months later...

The value start and end are some %. When your end has 11 means 11% of all of the animations available in models.

 

var totalFrame = skeletons[0]._scene._activeSkeletons.data.length; scene.beginAnimation(skeletons[0], 100 * 0/totalFrame, 100 * 11 /totalFrame, true, vitesse);

More information here:

http://www.html5gamedevs.com/topic/2947-scenebeginanimation-fromto/

Link to comment
Share on other sites

Wonderful what you can learn quite by accident from some of these threads.

 

1.

 

you can launch animation on each bone if you want

 

Works like a charm - and just seems to have solved a problem I was having :)  :)

myScene.beginAnimation(mySkeleton.bones[4], 90, 110, false, 1, function(){...});

2. From the jsfiddle posted by kolar above, I may have found out two things:

BABYLON.SceneLoader.ImportMesh(null, "https://dl.dropboxusercontent.com/u/12395133/", "bieber.babylon", scene, function (newMeshes, particleSystems, skeletons) {    var chlop = newMeshes[0];    scene.beginAnimation(skeletons[0], 1, 11, true, 1.0);    chlop.position.x = -1;});

a. I can use my dropbox to demo files -though not tried it yet.

 

b. the ImportMesh can return "skeletons" - all the code I have seen just had "function(newMeshes, particleSystems)".

 

 

cheers, gryff :)

Link to comment
Share on other sites

 

The value start and end are some %. When your end has 11 means 11% of all of the animations available in models.

 

var totalFrame = skeletons[0]._scene._activeSkeletons.data.length; scene.beginAnimation(skeletons[0], 100 * 0/totalFrame, 100 * 11 /totalFrame, true, vitesse);

More information here:

http://www.html5gamedevs.com/topic/2947-scenebeginanimation-fromto/

 

 

It's not true in my example. I used animation that has 30 frames (you can check it in .babylon file) so   

scene.beginAnimation(skeletons[0], 0, 30, true, 1);

should play only ~10 frames, but it plays whole animation. See: http://jsfiddle.net/kolar/gPt7U/4/

Link to comment
Share on other sites

Well if I was trying to play only 10 frames of a 30 frame animation then:

 

I used animation that has 30 frames (you can check it in .babylon file) so 
   scene.beginAnimation(skeletons[0], 0, 30, true, 1); 
should play only ~10 frames, but it plays whole animation.

 

I would change the "30" to "10" -  as you are telling it to play 30 frames with that code.

 

cheers.gryff :)

Link to comment
Share on other sites

So there is a bug.

 

I just wanted reported that they are %, because everyone does not know that 30 is not 30 frame, but 30%. unless this change is Deltakosh

 

Edit: I also think that if there is less than 100 frame, it is not % but the frames is calculated. (This is the impression I)

Link to comment
Share on other sites

  • 1 year later...

I know this is a pretty old thread, but I was trying to look up some information on scene.beginAnimation and came across this via a search, so wanted to make sure this was not left hanging (almost two years, but hey why not).

 

As far as a I can tell, from and to are the specific frames (at least when exporting with Blender), not percentages (BabylonJS v2.2)

 

Also seems to be confirmed here: http://doc.babylonjs.com/tutorials/07._Animations#parameters-for-scenebeginanimation

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...