Havok: Strange behavior dragging with constraint

OS: Windows 10
Browser: Chromium and Firefox
Playground: https://playground.babylonjs.com/#112FXI#2
Desc: I’m trying to drag a mesh with physics enabled with constraint, to make dragging more natural, but when the mesh VASE_CYL_VASE_CYL_CERAMIC_0 being clicked, it flies out.

cc @Cedric

Let’s be patient, though, as @Cedric is currently on vacation.

I think it’s due to a miscalculation of the position due to scaling (yours or babylonjs’).
After resetting the model scaling it behaves normally. Here is an example of pg.


This is an interesting find. I’l check and see if I can find a fix in bjs.

I did some tries and @qq2315137135 is right, it’s a miscalculation in pivot for the constraint. It’s even more visibile with a scaling of 0.9.


How could I compute pivot correctly, so the mesh does not move when pointer does not move? Thank you in advance.

You need to modulate the pivot position with the scaling.

1 Like

Can you kindly provide more info on this? Does it mean multiply the axis with scaling like this?

yes, scaling object and local coord.
check lines 32 and 102


Thank you, it works :smiley:

1 Like