Page 1 of 1

Adding new robots to simulation in loop functions

Posted: Tue Dec 17, 2019 1:30 am
by jharwell
Hi Carlo,

I'm currently trying to dynamically add robots to the simulation in the loop functions, and have gotten stuck. I see the provided AddEntity() function, which is what I need to call I think, but I am not sure how to create the robot entity and associate a controller with it. Here is what I have so far:

1. Create a CFootBotEntity via new
2. Call the created entity's Init() function, passing an appropriate XML tree tag
3. Call CLoopFunctions.GetSpace().AddControllableEntity(entity) with the initialized entity--or should I just call AddEntity()? Does it matter?

What am I missing?

Thanks!

Re: Adding new robots to simulation in loop functions

Posted: Tue Dec 17, 2019 2:02 am
by pincy
There's an explicit example called "custom distributions", have a look here.

Re: Adding new robots to simulation in loop functions

Posted: Tue Dec 17, 2019 3:51 am
by jharwell
I didn't think to check the examples--thanks that's exactly what I was looking for!