# Havok: Incorrect scaling of mesh when dragging with constraint

**URL:** <https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113>\
**Category:** Bugs\
**Tags:** physics, drag, bug, havok\
**Created:** [April 29, 2024, 8:35am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113 "2024-04-29T08:35:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [April 29, 2024, 8:35am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/1 "2024-04-29T08:35:43Z")

</div>

OS: Windows 10  
Browser: Chromium and Firefox  
Playground:

> **[Babylon.js Playground](https://playground.babylonjs.com/#112FXI%239)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Desc: I’m trying to drag a mesh with physics enabled with constraint, to make dragging more natural, but when the mesh being dragged, the scaling of meshes goes wrong.  
Video:

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 29, 2024, 10:40am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/2 "2024-04-29T10:40:37Z")

</div>

> [@kzhsw](#):
>
> the scaling of meshes goes wrong

If it can help you in debugging: I have seen this error pattern with messed up quaternions, too. So not necessirly scaling.

---

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [April 30, 2024, 12:43am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/3 "2024-04-30T00:43:11Z")

</div>

Using buildin inspector of playground, the changing of scaling can be observed like this:

 ![scaling](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/7/27bf0f3af78a8d15e073ec7ab0cbdf544e4edaea.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 2, 2024, 12:48am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/4 "2024-05-02T00:48:31Z")

</div>

Assigned @Cedric on May 2, 2024, 12:48am UTC



---

<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:** [May 13, 2024, 2:43pm UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/5 "2024-05-13T14:43:00Z")

</div>

This is an interesting bug! yes, it looks a bit like non normalized quaternion. I’ll take a closer look asap

---

<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:** [May 14, 2024, 3:01pm UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/6 "2024-05-14T15:01:39Z")

</div>

I’ve found a fix.  
Please test it when the snapshot is available @kzhsw

> <https://github.com/BabylonJS/Babylon.js/pull/15097>
>
> Fixes for : 
> \- https://forum.babylonjs.com/t/havok-plugin-dispose-returns-error…/50087

---

<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:** [May 14, 2024, 3:01pm UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/7 "2024-05-14T15:01:41Z")

</div>

Unassigned @Cedric on May 14, 2024, 3:01pm UTC



---

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [May 15, 2024, 12:51am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/8 "2024-05-15T00:51:59Z")

</div>

The scaling does not change now with this pr, but the box jumps out and does not stop moving even after pointer released. Is there something wrong with my playground or more fixed needed?

> **[Babylon.js Playground](https://playground.babylonjs.com/?snapshot=refs%2Fpull%2F15097%2Fmerge#112FXI%239)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<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:** [May 15, 2024, 7:40am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/9 "2024-05-15T07:40:05Z")

</div>

Yes, I think it’s related to the way the constraint is set. it pushes the box to a position that generates collisions.

---

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [May 15, 2024, 8:52am UTC](https://forum.babylonjs.com/t/havok-incorrect-scaling-of-mesh-when-dragging-with-constraint/50113/10 "2024-05-15T08:52:18Z")

</div>

Could you provide some example on how to set the constraint correctly? I’m quite new to havok.
