Hello ,
I am currently trying to assign the animation data to the doors and drawers in my model ,the drawers are translating acc to the amplitude provided but the doors are not rotating in the specified manner.The general behaviour is that they don’t rotate on the pivot point. I am working with GLTF.
The doors are of two types- Left shutter and right shutter depending upon in which direction they open.I am able to get the specfied outputs of left shutter and right shutter by using getOutputByName.The structure of doors consists of two things-fascia and handles which is present inside the childrens.Now suppose I have 4 left shutters then inside the child node- fascia and handles there will be 4 sub childrens accordingly ,if 5 left shutters then there will be 5.
Now i group individual fascia and handle together to form 1 group which represents one left shutter.After creating individual groups for each left shutter I make those group selectable.Then i combine all the groups and basis on the length (2 for shutters and 5 for drawers) i apply animations on them.
For applying animations i get the pivot points from the converted object’s position attribute and use it to provide the values required for animation.
Is my approach to provide the animation data correct cause it is not working for shutters or there is some other way to achieve the required functionality.
I have attached the code file as well as a short video to show what actually is happening for reference .
Plus if a model is created on grasshoper where can i find the actual animation data which is present inside the gltf.
animations.zip (3.2 KB)
Can you help me with this ? @MajorMeerkatThe3rd @mathieu1
Hello @Amod_Katiyar,
the pivots you are setting for the animations are not correct. The pivot for a rotation is the point around which the object should rotate. This is in your use case the hinge of each door. From the top view this would look like this:
It’s probably best if these pivot values are calculated in GH for each of the doors as they will change once the shelf changes. I’m not sure why you used the convertedObjects at all in this case.
What do you mean with this comment? As you create the animation on the frontend side, it doesn’t exist in Grasshopper.
Cheers, Michael
Hello @MajorMeerkatThe3rd ,
I am using the position attribute which is present inside the converted object as location for pivot points.The TreeNode inside each group have converted object which contains position.The value of positions in all the groups are the correct position at which the hinge (pivot) of the door should be.
And by that comment I meant that the animations array inside the converted object is empty so what actually refers to the animation data ?
Is it supposed to be empty or I am looking in the wrong place for the animation data?
Attaching the screenshots of the Group and the TreeNode structure for reference.
(The position in this is same as the hinge (pivot) required for the last door in the video and the empty animations array is also visible in this)
Thanks for responding,
Cheers Amod.
Hello @Amod_Katiyar,
could you share a link to the model or the model itself so that we can have a look at this issue? There might be issues like other transformations that are applied in Grasshopper or offsets that are not used correctly. Something I can only tell with certainty after doing a deep dive.
Regarding the animations array, this is intended. As we use our own animation logic, the animations array of three.js is not used. You can see the animations that you created in the global animation store under ViewportApi.animations.
Cheers, Michael
Hi @MajorMeerkatThe3rd
Thank you for your response.
I’d like to provide more clarity on the issue we’re facing.
The animation code we’ve developed is based on the example sandboxes you provided and has been working well with meshes. However, after transitioning to GLTF geometry, we’re encountering issues with animating rotation.
In the GLTF data, we’ve appended positions from GH, so we know where the animation should start. The translation part is working fine—when we use the position data for translation, the GLTF geometry animates correctly.

The problem arises when we try to apply rotation. The positions are not being read as expected. Even when we hard-code the pivot point, the animation behaves as shown in the first video—the geometries rotate from their initial position rather than the new one.
We applied translation on the same doors using the positions and it works as shown in the attached video which gives us an idea that the position coordinates are correct as it works as expected(That is the door translates outward )
We were wondering if there’s a way to adapt the rotation code for GLTF geometries. The translation works perfectly, which suggests that we are retrieving the correct data from GH. If we weren’t, the translation wouldn’t function properly either.
Any guidance on how to resolve this would be greatly appreciated.
Cheers Amod.
Hello @Amod_Katiyar,
can you go into more detail by what you mean with the change from meshes to glTF? The viewer always receives glTF as our GrassHopper components always convert them to glTF.
As I mentioned in my message before, please send me a link to the model on the platform or the GrassHopper file itself. Otherwise I cannot tell you what the issue is as there might many different sources for it.
If you don’t want to share this publicly, you can also send me a PM!
Cheers, Michael
Hello @MajorMeerkatThe3rd ,
Sorry for the late reply.
I further tried to work and resolve the issue and one of the ways worked in which we first translate the door to the pivot points and then apply the rotation animation .This way the doors rotate from the intended position but another issues occurs in this as soon as the door completes the rotation animation it moves back to the default coordinates(origin).
When I click on the door which is at origin it translates back to the intended position performs rotation and then goes back to the origin.
Can u help me identify the issue and resolve it. Plus some insights on the approach of translating the doors to the pivot and then applying rotation .
I have attached the code file and a video for your reference.
animations.zip (3.7 KB)
Cheers Amod.
Hello @Amod_Katiyar,
On the AnimationData there is a property called reset
, you can set this property to false
so that the animation doesn’t reset after it has been finished.
Cheers, Michael
Hello @MajorMeerkatThe3rd ,
Thanks for the help on animation .Those are working pretty good now.
I encountered another issue with the ar feature earlier when we were using meshes output from grasshoper it was working fine but when we switched to gltf output it started giving errors.
I erad that the api in itslef converts to gltf and then process further maybe its already gltf thats why its creating issue .I am not exactly sure .
Have attached the code and error which comes along with this.
Cheers Amod.
ar_integration.zip (1.7 KB)
Another small query is it possible to export the whole scene as gltf object so that i can load it in threejs ?
Hello @Amod_Katiyar,
can you please provide a link to the model in question on the platform? Then we can review this issue!
And yes, it’s easily possible to export the whole scene as a glTF, you can use this API call.
Cheers, Michael
Hello @MajorMeerkatThe3rd ,
The link for the model is - https://www.shapediver.com/app/m/mikasa-1-141-3
Do tell if anything else is required
Cheers,Amod
Hello @Amod_Katiyar,
we have identified an issue and are working on a release for it. I’ll let you know once that is done!
Cheers, Michael
Hello @Amod_Katiyar,
this issue has been resolved in viewer version 3.7.1
. Please try it out and let us know if it works for you!
Please note, this version has not been deployed to the platform yet, so the issue will still happen there for the next few days.
Cheers, Michael
Hey @MajorMeerkatThe3rd,
Has the AR issue been resolved on the platform, and do we need to create a new ticket to use it?
Cheers, Amod
Hello @Amod_Katiyar,
if you have used iFrame embedding, there are no further steps. If you have yourself an implementation with the viewer API, please update to the latest viewer version 3.7.3
.
Cheers, Michael