Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add some mouse tracking. #1

Merged
merged 1 commit into from May 30, 2012

Conversation

Projects
None yet
2 participants
Contributor

ianbarber commented May 30, 2012

Adding in a couple of small features. Firstly, had to bump to clj 1.4.0 in order to get the mouse stuff working with this version of Quil. Then added a mouse update callback (:mouse-moved in the sketch) and included that in the update loop for the boids. The mouse position is stored in the canvas state as an atom, along with the boids.

The mouse pos is just subtracked from the current pos, and the whole direction is multiplied by the cohesion value so that the boids just drift that way. Note you have to click before the applet tracks the mouse.

I also reinstated the cohesion average, and added a bound function that just clips the speed to stop the boids getting ot of control. Haven't done the avoid function yet.

Adding in a couple of small features. Firstly, had to bump to clj 1.4…
….0 in order to get the mouse stuff working with this version of Quil. Then added a mouse update callback (:mouse-moved in the sketch) and included that in the update loop for the boids. The mouse position is stored in the canvas state as an atom, along with the boids.

The mouse pos is just subtracked from the current pos, and the whole direction is multiplied by the cohesion value so that the boids just drift that way. Note you have to click before the applet tracks the mouse.

I also reinstated the cohesion average, and added a bound function that just clips the speed to stop the boids getting ot of control. Haven't done the avoid function yet.

@rosejn rosejn merged commit ae4a09a into rosejn:master May 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment