xtreampb Posted December 14, 2012 Share Posted December 14, 2012 I posted that b/c i changed it back. I removed the pointers at 'entity0' and 'entity1' and the above line is still throwing the error. Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
DaDonik Posted December 14, 2012 Share Posted December 14, 2012 The collision callback you pass to SetEntityCallback() can't be a member function of a class Thats not quite true, the callbacks can also be static class member functions. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Roland Posted December 14, 2012 Share Posted December 14, 2012 This works class MyClass { TEntity _this; static void _stdcall _onCollision( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed ); public: MyClass(); }; MyClass::MyClass() { // create the entity _this // _this = CreateXXXXX // register for collison detection SetEntityUserData( _this, reinterpret_cast<BP>(this) ); SetEntityCallback( _this, reinterpret_cast<BP>(_onCollision), ENTITYCALLBACK_COLLISION ); } void MyClass::_onCollision( TEntity us, TEntity them, byte* position, byte* normal, byte* force, flt speed ) { MyClass* pThis = reinterpret_cast<MyClass*>(GetEntityUserData(us)) ; if( pThis == 0) return; // Do your thing on collision // You are pThis } 1 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Rick Posted December 14, 2012 Share Posted December 14, 2012 Yeah, that's another way to do it. I just prefer having 1 callback function that automatically handles all my collision forwarding to my objects. 1 Quote Link to comment Share on other sites More sharing options...
xtreampb Posted December 18, 2012 Share Posted December 18, 2012 my OnColl function is only calling the collision of the last instance of the class that was created. so if one entity collides with another, if another instance of the entity was created after this one, then only the last entity collision function will be called. so another example, object_1 object_2 object_3 was created using class A. rock_1 rock_2 rock_3 was created using class b. when rock_ rock_2 rock_3 collide with object_2, the collisions for object_3 is called and executed. this is done using ricks method. is this happening b/c of polymorphism? i don't see how. anyone got any ideas? Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
xtreampb Posted December 19, 2012 Share Posted December 19, 2012 I fixed the issue. I needed to set my block object as a pointer and pass the pointer to the list that stored all my block objects. Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
xtreampb Posted April 23, 2013 Share Posted April 23, 2013 hey rick. Does this work with LE3 as well or what are you doing for your collision handling in Leadwerks 3? Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! 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.