black-square / birdflock Goto Github PK
View Code? Open in Web Editor NEWBird Flocking Simulation (Unity3D)
Home Page: http://black-square.github.io/BirdFlock/
License: MIT License
Bird Flocking Simulation (Unity3D)
Home Page: http://black-square.github.io/BirdFlock/
License: MIT License
I can use your scenes the Main and it will work fine.
But i'm trying to use the whole package on my own scene and i want to make simple two way points so the birds will fly between them. So i added two Spheres to my scene and added to them the Trace script.
And added to the Main Camera the scripts camera control and main and drawer but i can't see the birds.
Even there are 100 birds i can't see them. Double click on any of the birds when the game is tunning not moving the camera to the clicked bird. But i can see the objects the birds moving i see in the Inspector i see the X Y Z change.
So i can't figure out what i did wrong.
Could you show me a sample how to make it work on a terrain with only two spheres as way points ?
Or maybe to take a look on my project ?
Thank you.
To mesure:
In the Main.cs script there is a line:
public float BirdsCount = 10;
I tried to change it to 10 to 100 to 1000 to 1 but it didn't change the number of birds when running the game.
I want to be able to change the number of birds in two cases one when the game is running and then in the Inspector on the Main.cs script attched to the Main Camera if i type change the value to 1 there will be 1 bird if i change to 60 there will be 60 birds.
The second case is when the game not running when i'm in the editor and change the value in the Inspector and then running the game.
What i did so far and i guess i'm wrong is added a public variable to the top of the Main.cs:
public int _birdscount;
Then in the Update function i added this:
`bool isepressed = false;
void Update()
{
if (Input.GetKeyDown ("space"))
OnSettingsClick ();
if (Input.GetKeyDown("e"))
{
isepressed = true;
BoidSettingsEx eee;
eee = settings.boidSettings[settings.instancePointNum];
eee.BirdsCount = _birdscount;
SaveSettings `();
}
//We call it here to be sure that click on button desn't lead to camera target changing
if( !guiTools.MouseOverGUI && Input.GetMouseButtonDown(0) )
cameraControl.CheckForNewTarget( Input.mousePosition );
guiTools.ManualUpdate();
}`
And in the SaveSettings i did:
void SaveSettings() { if (Application.isEditor) { using (var str = new FileStream (SettingsFilePath, FileMode.Create)) serializer.Serialize (str, settings); } if (isepressed == true) { using (var str = new FileStream (SettingsFilePath, FileMode.Create)) serializer.Serialize (str, settings); isepressed = false; } }
So when i click the e button it should change the value and update the Settings.xml file on the hard disk.
So it does changing the value in the Settings.xml file in the first part:
6
But in the other two places in the file where there is the line:
10 The value not change.
Thank you for the help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.