I have created the ground plane by using the following statement and now I require to add some Simple Vehicles on top of the plane.Even though I added vehicles, they are not visible in the demo . So could anyone help me on that.
I think this will helpful to understand what I have done so far. Here bee hive is represented as collection of insects while abstract vehicles represent random moving civilians.
But there is a problem again in updating civilians and insects. In my code I have given to update both civilians and insects within two loops. Even though functions are called correctly, visually I can see that only one group moving. So how can I over come this problem.
Thanx
Dulani
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In your picture, the yellow "dots" in the upper left are the bees? You see both groups displayed but only one of them is moving? That suggests the plug-in's redraw method is OK, while something is wrong with the update method.
In your plug-in's "update" method you have two loops, one for pedestrians and one for bees? Each of those iterate over a different collection defined as a std::vector? Is it the first or the second loop that seems to be working? If you comment out the working update loop, does the other one begin to work?
I don't have a good explanation, but I'm just trying to sort through the possibilities. Is there any chance that the group than is not moving just has very low velocity? (You could for example print out the speed() of each agent as you update it.) It would be good to verify that both of them work independently, then find out why they don't work together.
Craig
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, that yellow "dots" are bees and as you mentioned only one group (pedestrians) is moving. Here I have includes two loops within the "update" method, one for pedestrians and one for bees which are iterate over a different collection defined as a std::vector. Both loops worked independently and when both loops kept together only one loop (iterate over collection of pedestrians ) worked. But "update" methods for bees is called and print the speed of each bee. When comment out it then other loop is worked. Here bees have been give 2 initial speed and 10 max speed while each pedestrian has 2 initial speed and 7 max speed.
Still I cannot verify what is the problem in update method. If you can give me a clue it will be a great help.
Thank You
Dulani
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm happy to say that I have solved that problem some extend. I removed the statement that calls to the "reset" method of the bees. Now both bees and pedestrians are moving. Could you please tell me what is the importance of using that "reset " method in the plug-in?
void reset (void)
{
// reset each bee
//for (iterator i = bees.begin(); i != bees.end(); i++) (**i).reset();
// reset camera position
OpenSteerDemo::position3dCamera (*OpenSteerDemo::selectedVehicle);
// make camera jump immediately to new position
OpenSteerDemo::camera.doNotSmoothNextMove ();
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The plug-in's reset method should be called just once, when the plug-in is started, by OpenSteerDemo. It is just a "hook" that allows the plug-in to do any setup or initialization it might need. Keep in mind that OpenSteerDemo can switch between any of its plug-ins, like changing channels on TV. So the reset method is called to tell the plug-in to get ready to run (maybe for the first time, or maybe after running some other other plug-ins which could have left global parameters (like the camera position) in an unknown state).
Calling reset too often (say each frame) would indeed make the agents not move since they would keep being set back to their initial position. I'm glad you got this working, feel free to ask more questions as they come up.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have created the ground plane by using the following statement and now I require to add some Simple Vehicles on top of the plane.Even though I added vehicles, they are not visible in the demo . So could anyone help me on that.
// draw ground plane
OpenSteerDemo::gridUtility (Vec3(10,-5,0));
Look into your agent (boid) class - it has a "draw" method that needs to be implemented.
Then don't forget to call the draw method of your agents from the "redraw" method of your plugin class.
Thank you very much for your kind consideration. It was really helpful.
Dulani
Great to hear! I am curious to see your results and it would be nice if you could link some screenshots (if you are allowed to show your results) ;-)
Cheers,
Bjoern
I think this will helpful to understand what I have done so far. Here bee hive is represented as collection of insects while abstract vehicles represent random moving civilians.
But there is a problem again in updating civilians and insects. In my code I have given to update both civilians and insects within two loops. Even though functions are called correctly, visually I can see that only one group moving. So how can I over come this problem.
Thanx
Dulani
http://www.4shared.com/photo/8hgyPmIf/img.html
In your picture, the yellow "dots" in the upper left are the bees? You see both groups displayed but only one of them is moving? That suggests the plug-in's redraw method is OK, while something is wrong with the update method.
In your plug-in's "update" method you have two loops, one for pedestrians and one for bees? Each of those iterate over a different collection defined as a std::vector? Is it the first or the second loop that seems to be working? If you comment out the working update loop, does the other one begin to work?
I don't have a good explanation, but I'm just trying to sort through the possibilities. Is there any chance that the group than is not moving just has very low velocity? (You could for example print out the speed() of each agent as you update it.) It would be good to verify that both of them work independently, then find out why they don't work together.
Craig
Yeah, that yellow "dots" are bees and as you mentioned only one group (pedestrians) is moving. Here I have includes two loops within the "update" method, one for pedestrians and one for bees which are iterate over a different collection defined as a std::vector. Both loops worked independently and when both loops kept together only one loop (iterate over collection of pedestrians ) worked. But "update" methods for bees is called and print the speed of each bee. When comment out it then other loop is worked. Here bees have been give 2 initial speed and 10 max speed while each pedestrian has 2 initial speed and 7 max speed.
Still I cannot verify what is the problem in update method. If you can give me a clue it will be a great help.
Thank You
Dulani
I'm happy to say that I have solved that problem some extend. I removed the statement that calls to the "reset" method of the bees. Now both bees and pedestrians are moving. Could you please tell me what is the importance of using that "reset " method in the plug-in?
void reset (void)
{
// reset each bee
//for (iterator i = bees.begin(); i != bees.end(); i++) (**i).reset();
// reset camera position
OpenSteerDemo::position3dCamera (*OpenSteerDemo::selectedVehicle);
// make camera jump immediately to new position
OpenSteerDemo::camera.doNotSmoothNextMove ();
}
The plug-in's reset method should be called just once, when the plug-in is started, by OpenSteerDemo. It is just a "hook" that allows the plug-in to do any setup or initialization it might need. Keep in mind that OpenSteerDemo can switch between any of its plug-ins, like changing channels on TV. So the reset method is called to tell the plug-in to get ready to run (maybe for the first time, or maybe after running some other other plug-ins which could have left global parameters (like the camera position) in an unknown state).
Calling reset too often (say each frame) would indeed make the agents not move since they would keep being set back to their initial position. I'm glad you got this working, feel free to ask more questions as they come up.