MexSource Posted April 15, 2014 Share Posted April 15, 2014 Hey, I already created some triggers with leadwerks 3.0 but now in 3.1 i have one problem. It says: invalid type conversion at this line: currEnt->AddHook(Entity::CollisionHook, (void*)onCollision); heres my App.h: #pragma once #include "Leadwerks.h" using namespace Leadwerks; class App { public: Leadwerks::Window* window; Context* context; World* world; Camera* camera; App(); virtual ~App(); void onCollision(Entity* entity0, Entity* entity1, float* position, float* normal, float speed); virtual bool Start(); virtual bool Loop(); }; and the important part of my App.cpp [...] //The onCollision function void onCollision(Entity* entity0, Entity* entity1, float* position, float* normal, float speed){ } [...] //and in App::Start [...] list<Entity*>::iterator iter; for (iter = world->entities.begin(); iter != world->entities.end(); ++iter){ Entity* currEnt = (*iter); cout << "Entity loaded: " + currEnt->GetKeyValue("name") << endl; if (currEnt->GetKeyValue("name") == "runner_spawn"){ runner_spawn = currEnt->GetPosition(); } if (currEnt->GetKeyValue("name") == "death_spawn"){ death_spawn = currEnt->GetPosition(); } if (currEnt->GetKeyValue("name") == "runner_mesh"){ runner_mesh = currEnt; } if (currEnt->GetKeyValue("name") == "death_mesh"){ death_mesh = currEnt; } if (currEnt->GetKeyValue("name") == "void"){ currEnt->AddHook(Entity::CollisionHook, (void*)onCollision); } } [...] if you need more code i will give it out, but i think that should be enough Thanks, Mex Quote C++ :3 Link to comment Share on other sites More sharing options...
Rick Posted April 15, 2014 Share Posted April 15, 2014 You are prototyping your onCollision inside your App class in the header. Take it out of there because it can't be part of a class. Quote Link to comment Share on other sites More sharing options...
MexSource Posted April 15, 2014 Author Share Posted April 15, 2014 oh that seems to work, thanks rick Quote C++ :3 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.