Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

I'm trying to use Brownian motion to create a group of random moving particles.http://jsfiddle.net/J75Em/16/

So far I've got the particles moving randomly but I'm not sure how to set the forward direction to make it look more natural.

I've tried to use the change in x and y-axis to calculate rotation using atan, you can see this by uncommenting rotate but this doesn't seem to perform well.

Is this the right approach for this type of movement? thanks.

1 Answer

0 votes
by (108k points)

Yes, your approach is right. You can manipulate the odds a little so it is not entirely random. Like 85% random and 15% the last direction or something like that. I think this will make it go a little bit more in the forward direction. The trouble is that you expect to rotate to set the rotation when it actually adds to the rotation.

There are 2 options for fixing this.

  1. Rotate by the difference between the previous and the current angle

  2. Set the rotation using the .transform method

Browse Categories

...