# Studio: ecs.ScaleAnimation.set(..) not working when a Collider is attached to the entity

**URL:** <https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129>\
**Category:** Technical Support\
**Created:** [October 11, 2024, 5:38am UTC](https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129 "2024-10-11T05:38:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Di\_Guida](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/alex_di_guida/32/369_2.png) [@Alex\_Di\_Guida](https://forum.8thwall.com/u/Alex_Di_Guida)\
**Post date:** [October 11, 2024, 5:38am UTC](https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129/1 "2024-10-11T05:38:22Z")

</div>

Hi everyone,

In Studio, I need to play a scale animation at a certain point in my experience on an entity that also has a GLTF model attached to it. It was working fine until I added a **Collider** component to this entity.

• **Without a collider attached to my entity** , I can trigger a scale animation using ecs.ScaleAnimation.set(…) in my code when needed.

• **With a collider attached** , if I try to call ecs.ScaleAnimation.set(…), the GLTF model does not scale up.

Here I created a very basic code to reproduce the issue in a smaller experience:

 ![scale-animation-working](https://us1.discourse-cdn.com/flex019/uploads/x8thwall/original/2X/b/b06a19802f963be66833180c8bd786930f2eefef.jpeg)  
 ![scale-animation-NOT-working](https://us1.discourse-cdn.com/flex019/uploads/x8thwall/original/2X/5/58d6a78f9e84a004e08590b0979b01923e1de6d7.jpeg)

If you perform the same test using an event listener either from a button click event or by calling `world.events.dispatch(...)`,you get the same result: with a Collider component, the scale animation never scales up my model.

Although even with a Collider attached to the entity, if in your custom component you immediately call `ecs.ScaleAnimation(..)` in the `add: () =>` function the scale animation will be working. But from the moment you play the animation inside a callback, delay it, it won’t scales up the model.

Is this a bug or not? How can I delay a scale-up animation to be played only when I need it? Let me know if you need more details or something is unclear in what I shared.

Thank you

---

<div class="post-metadata">

**Author:** ![Alex\_Di\_Guida](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/alex_di_guida/32/369_2.png) [@Alex\_Di\_Guida](https://forum.8thwall.com/u/Alex_Di_Guida)\
**Post date:** [October 11, 2024, 6:10am UTC](https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129/2 "2024-10-11T06:10:11Z")

</div>

I’m still not entirely sure why I have this issue, but I found a workaround for my situation. I’m sharing it in case someone else is facing the same problem:

When setting the Scale Animation, I add a timeout right after, with a duration that matches my animation time plus an extra delay (X). This ensures that the Collider is added by code after the animation finishes, instead of having it directly on the entity in Studio. It looks like this:

```auto
ecs.ScaleAnimation(.... ,{
...
duration: 800,
})

setTimeout(() => {
  ecs.Collider.set(world, eid, {
    shape: ecs.ColliderShape.Capsule,
    radius: 1,
    height: 5,
  })
}, 1000)

```

Now the collider is working and the Model has been scaled up as expected.

---

<div class="post-metadata">

**Author:** ![Herman\_Ptacnik](https://avatars.discourse-cdn.com/v4/letter/h/5f8ce5/32.png) [@Herman\_Ptacnik](https://forum.8thwall.com/u/Herman_Ptacnik)\
**Post date:** [March 20, 2025, 9:08pm UTC](https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129/3 "2025-03-20T21:08:18Z")

</div>

I had the same issue and ended up doing the same. 😆

However, since my tower has colliders, they sometimes cause the structure to jiggle and collapse when they shouldn’t. Sometimes they even fall down the ground as well.

I want the colliders to remain dynamic but only trigger a fall when an actual collision occurs.

I came across a thread mentioning that larger colliders improve collision detection. My question is: how big should they be? I want to balance better detection without significantly impacting performance.

For reference, I have between 10 to 30 colliders per space.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/x8thwall/original/2X/1/1ad2f044176e19dc31e9bf0d4b25bbefaecdb842.png)

---

<div class="post-metadata">

**Author:** ![christoph\_nia](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/christoph_nia/32/83_2.png) [@christoph\_nia](https://forum.8thwall.com/u/christoph_nia)\
**Post date:** [March 21, 2025, 5:42pm UTC](https://forum.8thwall.com/t/studio-ecs-scaleanimation-set-not-working-when-a-collider-is-attached-to-the-entity/3129/4 "2025-03-21T17:42:57Z")

</div>

Hi Alex!

I would recommend not setting scale to 0 on a physics object as that seems to cause “division by 0” errors where the position becomes “NaN”.

One option is to do `fromX: 0.01`, which should basically look the same, and another option is to set the GLTF model as a child of the collider, and put that animation on that child.
