I have some issue with dynamic cast for the loop function that I have created. Here is a part pertaining to the dynamic cast:
Code: Select all
CFootBotEntity& footBot = *any_cast<CFootBotEntity*>(it->second);
CFootBotMobile& controller = dynamic_cast<CFootBotMobile&>(footBot.GetControllableEntity().GetController());
Besides that, I have deduced the issue behind the std::bad_cast error and able to reproduce it. The fault lies in the fact that I used two different footbot controllers within my xml file. Hence, the only way of fixing it is using only one of the controllers at a time but the setup that I am planning requires those two controllers to work.
I am wondering if there is any suggestion to solve this issue?