Home › Forums › Programming › Animating cloned objects
Tagged: clone animations
- This topic has 23 replies, 8 voices, and was last updated 7 months, 3 weeks ago by c4cc.
-
AuthorPosts
-
2020-09-09 at 9:36 pm #32640origginParticipant
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?
2020-09-10 at 6:33 am #32652Yuri KovelenovStaffHi,
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.
2020-09-10 at 12:33 pm #32678origginParticipantHi,
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 :(
2020-09-10 at 1:30 pm #32684Yuri KovelenovStaff2020-09-10 at 4:20 pm #32701origginParticipantcan 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
2020-09-10 at 4:44 pm #32702Yuri KovelenovStaff2020-09-10 at 4:48 pm #32703origginParticipantlooks 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.pngCan you open it?
2020-09-11 at 4:10 am #32710Yuri KovelenovStaff2020-09-11 at 12:17 pm #32745origginParticipantnope, 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.2020-09-12 at 6:15 am #32785Yuri KovelenovStaff2020-09-12 at 7:22 pm #32798GLiFTeKCustomerYou 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.)Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2020-09-14 at 1:26 pm #32855origginParticipantYou 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 ;)
2020-12-14 at 8:04 pm #36494core3dCustomerHello,
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.2022-07-27 at 9:32 am #54428kdvParticipantwhen 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 namedanimations
, 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 thecloneObject()
functionif (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 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.
2022-07-27 at 7:27 pm #54437kdvParticipantSome more strings and none-boned animations can be cloned too 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); }
p.s. It’s funny but there is
clone animation
puzzle But what does it do? It creates a copy for the same object?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.
-
AuthorPosts
- You must be logged in to reply to this topic.