# Curtain Physics animation

**URL:** <https://forum.babylonjs.com/t/curtain-physics-animation/38466>\
**Category:** Questions\
**Created:** [February 23, 2023, 12:31pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466 "2023-02-23T12:31:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karim\_Salam](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/karim_salam/32/30201_2.png) [@Karim\_Salam](https://forum.babylonjs.com/u/Karim_Salam)\
**Post date:** [February 23, 2023, 12:31pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/1 "2023-02-23T12:31:21Z")

</div>

Hello I’ve been trying to research and work on a project , to have a curtain with certain physics that when dragged to the right or left it should implement a real life curtain experience I was trying to add a plane and get its position vertices to add spheres and link them in order to use them as imposters , in that way maybe I can get that experience, it didn’t work yet I wanted to ask if there is a better idea ? And if not where to start maybe ?

I used this playground as a reference : [https://www.babylonjs-playground.com/#1J3WEP#3](https://www.babylonjs-playground.com/#1J3WEP#3)

followed a little of its steps but it didn’t work on an imported Model, I hope you guys can help,

Best Regards

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 23, 2023, 1:20pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/2 "2023-02-23T13:20:39Z")

</div>

Hello and welcome to the Babylon community! Can you show us a Playground with what you tried with your imported model? I can imagine it will need adjustments to account for being a custom mesh. We also have a Cloth soft body impostor, but it also uses the default ground mesh: [Soft Bodies | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/physics/softBodies#the-cloth-soft-body)

---

<div class="post-metadata">

**Author:** ![Karim\_Salam](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/karim_salam/32/30201_2.png) [@Karim\_Salam](https://forum.babylonjs.com/u/Karim_Salam)\
**Post date:** [February 23, 2023, 2:00pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/3 "2023-02-23T14:00:01Z")

</div>

Hello thank you , I added a simple plane done through 3ds max in this following playground link

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#1J3WEP%23375)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

this is what I’m testing on

Best Regards

---

<div class="post-metadata">

**Author:** ![withADoveInOneHand](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/withadoveinonehand/32/1243_2.png) [@withADoveInOneHand](https://forum.babylonjs.com/u/withADoveInOneHand)\
**Post date:** [February 23, 2023, 7:28pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/4 "2023-02-23T19:28:06Z")

</div>

> [@Karim\_Salam](#):
>
> a real life curtain experience

looks like it could use some dampening

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 24, 2023, 1:12pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/5 "2023-02-24T13:12:38Z")

</div>

You’ll need to keep in mind that the ground on the example PG and your ground mesh have a different number of vertices and faces:  
This is the example Ground  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/b/2b0c00947d335c1d750e4db2b1e38f96f28806f1.png)  
And in your PG:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/7/57ce4504869f5bb11d2b4202d3b82e5913827e3e.png)

---

<div class="post-metadata">

**Author:** ![Karim\_Salam](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/karim_salam/32/30201_2.png) [@Karim\_Salam](https://forum.babylonjs.com/u/Karim_Salam)\
**Post date:** [March 3, 2023, 2:12pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/6 "2023-03-03T14:12:00Z")

</div>

Hello sorry for the late response I was testing and trying different objects , so basically the physics and cloth soft body imposter doesn’t work if the mesh is imported ? it works only on certain objects created via Babylon, please correct me if I’m wrong

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [March 3, 2023, 2:24pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/7 "2023-03-03T14:24:18Z")

</div>

The Cloth Impostor is only for Ground Meshes (@Cedric correct me if I’m wrong), but the other physics impostors are applicable to any mesh, even imported ones.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 6, 2023, 1:22pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/8 "2023-03-06T13:22:23Z")

</div>

The cloth impostor can be used by any mesh. I used it for tshirt in a prototype some months ago.  
1 question tho, what do you want to curtain to do? if it’s only an animation for opening/closing, then maybe going full realtime is not the solution. And baking the animation would be simpler, better quality and would use way less CPU?

something else to evaluate:

> **[Verlet Integration and Cloth Physics Simulation](https://pikuma.com/blog/verlet-integration-2d-cloth-physics-simulation)**
>
> Physics simulation in games is a super vast and interesting topic! This article explores how Verlet integration can be used to simulate 2D cloth physics with JavaScript and C++.

I think this tailored solution will need a bit more work but it will use less memory and will be faster to initialize as it’s more specialized than the generic ammojs/physics version.

---

<div class="post-metadata">

**Author:** ![Karim\_Salam](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/karim_salam/32/30201_2.png) [@Karim\_Salam](https://forum.babylonjs.com/u/Karim_Salam)\
**Post date:** [March 6, 2023, 2:08pm UTC](https://forum.babylonjs.com/t/curtain-physics-animation/38466/9 "2023-03-06T14:08:23Z")

</div>

Thank you for your reply Cedric, I will take baking an animation into consideration but I had in mind to make the interaction with the curtains to be like the cloth simulation effect too, I will try using the link u sent to make it happen and maybe I will get back if there is anymore questions

Best Regards
