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.

Animating cloned objects

Home Forums Programming Animating cloned objects

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #32640
    origgin
    Participant

    Hi guys,

    Problem Scenario
    I have some doors in my scene which consist of some objects (frame, trail, sheets…) with the frame as their parent.

    The door sheets have been animated using keyframes in blender (position and rotation).

    These doors get cloned several times, to fit all floors.

    I am using puzzles to play the animations, but it is not working as expected.

    The puzzles play only the animations on the original objects. I tried to debug it and I found something interesting:

    Verge tries to find the animation by objects name (getAnimationActionByName()), comparing the name of the object to all items inside an array (e.actions).
    Inside this array I could only find the animations of the original objects and nothing from the cloned ones.

    So, I suppose this is the reason it does not animate the cloned objects.

    Now I am looking for a way to fix this problem. I need to animate every door individually. Is there a way to clone the animations as well?

    #32652

    Hi,

    when an object is cloned, a new name is assigned to it automatically and returned by the clone puzzle.

    So you can use this new name and the get animations puzzle to obtain a new animation clip to play.

    Chief 3D Verger | LinkedIn | Twitter

    #32678
    origgin
    Participant

    Hi,
    when an object is cloned, a new name is assigned to it automatically and returned by the clone puzzle.
    So you can use this new name and the get animations puzzle to obtain a new animation clip to play.

    I had already tried this and it did not work :(

    #32684

    can you post a screenshot of your puzzles?

    Chief 3D Verger | LinkedIn | Twitter

    #32701
    origgin
    Participant

    can you post a screenshot of your puzzles?

    I did not get what you exactly need from my puzzles. I posted a screenshot in my last reply.

    Here is another one with the puzzles that will play the animations in my scene

    #32702

    looks like the images were not attached :unsure:

    Chief 3D Verger | LinkedIn | Twitter

    #32703
    origgin
    Participant

    looks like the images were not attached

    Weird, they appear to me, their link:

    https://image.prntscr.com/image/DcVdjOVIR66BCXFNylcSwA.png
    https://image.prntscr.com/image/Rs6w74TSTnOCfBv7FNxU-w.png

    Can you open it?

    #32710

    nope, getting 403 Forbidden error

    Chief 3D Verger | LinkedIn | Twitter

    #32745
    origgin
    Participant

    nope, getting 403 Forbidden error

    :(

    Sorry, I am uploading them to the forum. Can you see them now?

    Attachments:
    You must be logged in to view attached files.
    #32785

    Apparently this is due to a bug in Verge3D. We’ll try to fix this ASAP. Thanks for reporting!

    Chief 3D Verger | LinkedIn | Twitter

    #32798
    GLiFTeK
    Customer

    You can also try changing the clones’ names. I THINK I got around this bug by doing this once..

    1st, get the object’s ‘name’ data…

    app.ExternalInterface.getMyObjectName = function(objName) {
            var myObj = app.scene.getObjectByName(objName)
            var gotName = myObj.name;
            return gotName;
            };

    then rename…

    app.ExternalInterface.changeMyObjectName = function(obj,newName) {
            var myObj = app.scene.getObjectByName(obj)
            myObj.name = newName;
            console.log (obj," is renamed as ", myObj.name);
            }; 

    Hope it helps!
    (Also you can use the exec puzzles now instead of the call JS function. Very handy.)

    #32855
    origgin
    Participant

    You can also try changing the clones’ names. I THINK I got around this bug by doing this once..

    This would not work for me because the object names are unique and got constructed using logic. Even the cloned ones are built in the scene using the clone index number as a reference for the floor.

    Unfortunately this same naming logic is being used for other 900+ objects and their state info is eventually sent to other interfaces to be processed for calculations (the project is a product configurator).

    So, changing their names would represent some big changes in the whole project across different environments :(

    By the way, I tried to rename them to their same name (there could be some kind of hidden proxy or observer on the name property) and nothing changed :(

    I will have to wait for a solution from the Verge3D team.

    Thanks anyway ;)

    #36494
    core3d
    Customer

    Hello,
    Is this fixed? i have same problem with animation cloning and using cloned animations for multiple objects…

    i’m cloning animation clip stored it on a list, then calling animations and only first one playing it.

    Attachments:
    You must be logged in to view attached files.
    #54428
    kdv
    Participant

    when an object is cloned, a new name is assigned to it automatically and returned by the clone puzzle.

    So you can use this new name and the get animations puzzle to obtain a new animation clip to play

    Nope. Object3D doesn’t contain info about its animations. It has an array named animations, but this array is empty. On the contrary, an animation (an action) contains info about what object should be animated.

    Here’s an example of the cloned bone-animated objects.
    https://v3d.net/9mp
    All of them are animated with the same animation and cannot be animated separately… To place bone-animated clones separatly you should add the following code into the cloneObject() function

        if (newObj.isBone) {
            const children = newObj.children;
            for (let j = 0; j < children.length; j++) {
                if (children[j].isSkinnedMesh) {
                    children[j].name = findUniqueObjectName(children[j].name);
                    children[j].bindMode = 'detached';
                }
            }
        } else if (newObj.isSkinnedMesh) {
            newObj.bindMode = 'detached';
        }

    Otherwise all clones will be shown at the same position, the position of the original object…

    Puzzles and JS. 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 meaning at all.

    #54437
    kdv
    Participant

    Some more strings and none-boned animations can be cloned too B-) They are even independant…

        const objAnim = v3d.SceneUtils.getAnimationActionByName(appInstance, objName);
        if (newObj.isBone) {
    ...
        } else if (objAnim) {
            const newAnim = appInstance.mixer.clipAction(objAnim._clip, newObj);
            newAnim._clip = newAnim._clip.clone();
            newAnim._clip.name = newObj.name;
            newAnim._localRoot = objAnim._localRoot;
            appInstance.actions.push(newAnim);
        }

    https://v3d.net/9e4

    p.s. It’s funny but there is clone animation puzzle :wacko: But what does it do? It creates a copy for the same object? :scratch:

    Puzzles and JS. 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 meaning at all.

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