Gilmer Posted June 2, 2011 Share Posted June 2, 2011 Hello guys.. I'm having two problems in use the EntityCollisionCallback and MessageReceiveCallback. The first problem, is that I'm using to make a shader fx when the car collid with an other entity. Like a shake in the camera, or a fast blur. The problem is that It's getting the terrain collision too, ie, the fx is everytime enabled, and just stop when the car is stopped. Have someway to dont get the collision between the car(entity0) and the terrain(entity1)?? I tried make this, but dont worked like I wanted: void _stdcall EntityCollisionCallback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed ) { if(forceCol<=0 && (int)entity1 != 44282192 && (int)entity1 != 144736320){ if(speed>10) Something(); } } And the other problem, is that as I'm using MessageReceiveCallback too, I was noted, that if I set both, like this code: SetEntityCallback(chassis,(byte*)MessageReceiveCallback,ENTITYCALLBACK_MESSAGERECEIVE); SetEntityCallback(chassis,(byte*)EntityCollisionCallback,ENTITYCALLBACK_COLLISION); the program is crashs. Now if I just put "MessageReceiveCallback", or "EntityCollisionCallback" work fine. Have some wrong in the use this? thx Quote Link to comment Share on other sites More sharing options...
Gilmer Posted June 7, 2011 Author Share Posted June 7, 2011 anyone? I really need that much... Quote Link to comment Share on other sites More sharing options...
Rick Posted June 7, 2011 Share Posted June 7, 2011 The value of the entity could really be anything when it gets loaded. I believe there is a key that you can read to tell if something is the terrain. I use that when I run my scene loading process. I don't remember what exactly it is. Something like "classname" or something. Use GetEntityKey(). You could likewise do the same thing with your "car" or player. Give it an entity key and check those inside your collision event. Personally what I do is wrap all these entities inside a class when I load the scene. Then I can cast these entities to the classes I car about using GetEntityUserData() and if the result is NULL I know it's not the class I care about. Quote Link to comment Share on other sites More sharing options...
Gilmer Posted June 7, 2011 Author Share Posted June 7, 2011 Thx rick, I'll try this.. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 8, 2011 Share Posted June 8, 2011 Your callback functions must use the Windows function protocol (unless you are using BlitzMax) and use the following arguments: void MessageReceiveCallback(entity:TEntity,name:Byte Ptr,extra:Byte Ptr) "win32" void CollisionCallback(entity0:TEntity,entity1:TEntity,position:Byte Ptr,normal:Byte Ptr,force:Byte Ptr,speed:Float) If you still have problems, please post a simple example I can run, in a bug report. Quote My job is to make tools you love, with the features you want, and performance you can't live without. 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.