Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How would I make them follow the mouse? #1

Open
LtqxWYEG opened this issue Jun 3, 2022 · 6 comments
Open

How would I make them follow the mouse? #1

LtqxWYEG opened this issue Jun 3, 2022 · 6 comments

Comments

@LtqxWYEG
Copy link

LtqxWYEG commented Jun 3, 2022

Hi :)

I would love to borrow your code to use in my program that I write for learning purposes only. There, stuff is following the mouse cursor on screen.
You implementation of boids looks very nice and seems also very performant. Now, your code isn't the easiest to read. Much math. Very complex. Variables have names like: "tAvejAng". What's that? Time-average-junction-angle? xD
Edit: Well I know have "targetAverage_j_Angle" and that basically represents my understanding of your code.

I like the new stuff I learn from your code: self.boidSize = 22 if isFish else 17 and if (neighborCount := len(neighborBoids)) > 1: I didn't know about that.. :)

I generally know how to get and use the mousecursor postion and speed. The only issue is that it seems like the movement is all random, that there is no destination I could hijack. The destination is some ephemeral "where the most boids are", I guess. Maybe... it's so hard to read xD

Can you give me a hint where to start?

I hope you'll see this in due time. But if not, thenn I have to figure it out. Maybe I start by changing variable names.
Thank you

@LtqxWYEG
Copy link
Author

LtqxWYEG commented Jun 10, 2022

Discord would be nice. I don't have one, but there's always the Python discord. (Sorry for some reason I'm not getting notifications here. Need to check github settings.) edit: Yes, now I'll get notifications.

Repository owner deleted a comment from Darius17TARS Jun 10, 2022
@Nikorasu
Copy link
Owner

Well, I've actually considered doing that in the past.. Although at the time, I figured it'd be a little tricky to do with my code, tho probably possible, and could require a little re-working of things.
Sorry for my lack of comments in the code, and my variables being a little oddly named.. I'll certainly have to do another update soon, to try and clean things up, and put in more detailed comments.
It's been about a year since I've worked on this in much detail, so I may be a little rusty with my explanations, tho if you'd like to chat over Discord sometime, my username is: Nikorasu#2462
And FYI, I'm not sure who Darius17TARS is.. lol

@Darius17TARS
Copy link

Darius17TARS commented Jun 13, 2022 via email

@LtqxWYEG
Copy link
Author

Wdym? Did you do that already? I'm still trying.

@Darius17TARS
Copy link

Darius17TARS commented Oct 11, 2022 via email

@chrislee35
Copy link

I added some features, including reading the mouse position and biasing the fish that way.
Please see https://github.com/chrislee35/PyNBoids/, copy anything you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants