Repulsion on InstancedMesh feels to "nervous"

Hi,

with all the great articles and snippets out there, and some nice help from @Mugen87 and @prisoner849 I managed to write a little InstancedMesh repulsion effect (onMouseMove).

Nevertheless, the repulsion feels way to “nervous”, meaning, it works like it should, but the raycasted meshs are “wobbly” when moving out of its possition where I want then to be more or less smooth animating out and remain at their “end-position” if no mouse is moving. Still they seem to animate a bit which feels kinda nervous…

Here goes a fiddle of it all:
https://jsfiddle.net/C3O3CI6/t18qscrn/33/

Any ideas how I could solve this?

Thanks
B

Hi!
Any ideas why it’s happening?

Found my mistake @prisoner849 …did raycast on the “to move” mesh every time, now raycasting an nonused floor (PlaneGeometry) I added so the raycast just finds this floor-mesh and then performs the iterations through the InstancedMeshs, works fine now!

https://jsfiddle.net/C3O3CI6/t18qscrn/43/

2 Likes

Exactly :slight_smile:
Great, you found it yourself :beers:

1 Like

Minimum time of calculationd is 4ms, maximum 10ms.