Soft mouse follow (ease)

Here we go, got it working I think. :slightly_smiling_face: :beers: There were a few issues to fix:

  1. Using the wrong indexes into the graph array. Probably using a Graph class instead of an array would cut down on these kinds of errors, that way you don’t have to remember which property is stored at which index in the array.

  2. For the LERPing, = needed to be changed to +=. Also some issues using y instead of x.

  3. You were using var for name and followDelay, which causes them to be created only once, so they always have the last value assigned to them. If you use const or let instead then a new variable will be created for each loop iteration and will be bound to the created observable function.

https://playground.babylonjs.com/#AMQMPH#12

5 Likes