How to apply collision tags
A Collision Tag is used to determine if your character collided with entityA or entityB.
The following snippet shows how to set a collision tag for a 3D entity using the method U4DEngine::
//Create a Game object U4DEngine::U4DGameObject *myIsland=new U4DEngine::U4DGameObject(); //..initialize rendering properties here.. //..Set collision properties here.. //Set colliding tag myIsland->setCollidingTag("island");
Then, you can check if your entity has collided with the model with tag island as shown in line 3:
void Astronaut::update(double dt){ // Line 1. Has astronaut collided if(getModelHasCollided()){ // Line 2. Get a list of entities it is colliding with for(auto n:getCollisionList()){ // Line 3. Check if the entity an island if (n->getCollidingTag().compare("island")==0) { std::cout<<"Collided with island"<<std::endl; } } } }