panamd Posted March 21 Share Posted March 21 Hi, I'm having some issues detecting the collisions between entities, I created my own object that inherits from Leadwerks::Model and overloads the method "OnCollision", but the method does not seem to be called. here is my code: class Player : public Leadwerks::Model { private: bool grounded; Model* model; public: Player() : Model::Model() { grounded = true; model = Model::Box(2, this); model->SetPosition(0, 1, 0); } void OnCollision(Entity* other, const Vec3& position, const Vec3& normal, float speed) override { if (reinterpret_cast<Terrain*>(other)) { grounded = false; } std::cout << "EwE" << std::endl; } void setGrounded() { grounded = true; } bool isGrounded() { return grounded; } }; Player* playerDummy = new Player(); playerDummy->SetPhysicsMode(Leadwerks::Entity::CharacterPhysics); playerDummy->SetPosition(0, 4, 0); playerDummy->SetMass(1); playerDummy->SetKeyValue("Name", "Player"); Leadwerks::Map::Load("Maps/temp.map"); Quote 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.