We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Sharing Animation Between Objects

Home Forums General Questions Sharing Animation Between Objects

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #69434
    masj
    Participant

    Hi,

    I’m trying to wrap my head around the V3D animation system, using a combination of puzzles, JS, and backwards engineering (mixers can have multiple actions, and each action contains a single clip, and is bound to a single object, I think..?).

    Anyways my question is:
    Is there a way to apply animation actions/clips from one object to another in v3d?
    I.e. simple transform keyframe animation clip from one object (position, rotation scale animated), and playing that on another 3D object?
    Assumed workflow would be something like having a few 3D objects with animation to use as a sort of “animation library” that several other objects could reference/clone (rather than applying the same convoluted timeline of clips to every object, then chopping it up into clips per object in V3D, etc).

    Please let me know if I can word anything more clearly if something doesn’t make sense…
    Any insight/advice on the matter is hugely appreciated. Thanks!

    #69436
    kdv
    Participant

    mixers can have multiple actions, and each action contains a single clip, and is bound to a single object

    Exactly.

    You can clone a clip and bind it to another object.

    const objAnim = v3d.SceneUtils.getAnimationActionByName(app, objName);
    if (objAnim) {
      const newAnim = app.mixer.clipAction(objAnim._clip.clone(), newObj, objAnim.blendMode);
      newAnim._clip.name = newObj.name;
      newAnim._localRoot = objAnim._localRoot;
      objAnim._mixer._isActiveAction(objAnim) && newAnim.play();
      app.actions.push(newAnim);
    }

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #69437
    masj
    Participant

    Thank you, kdv!

    I was hesitant to assign objects directly to what I was assuming were private properties, but this saves me a lot of going around in circles in the dev docs :good:

    Good to know about needing to update the app instance too. Thanks again!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.