Andr3wHur5t Posted August 4, 2010 Share Posted August 4, 2010 HI, can someone tell me how they get what object collided with another? Quote Tools: AC3D | 3D Canvas(pro) | Texture Maker(pro) | Genetica(basic) | 3D World Studio | Fragmotion |Leadwerks 2 | XNA 4 | Visual Studio 2010 Professional | XCode 5.x |UU3D Pro Programing & Scripting Languages: C |C++ | C# | Obj-C | LUA | Javascript | PHP | Ruby Link to comment Share on other sites More sharing options...
Joh Posted August 5, 2010 Share Posted August 5, 2010 EntityCollisionCallbackC: void _stdcall EntityCollisionCallback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed ) BlitzMax: EntityCollisionCallback(entity0:TEntity,entity1:TEntity,position:Byte Ptr,normal:Byte Ptr,force:Byte Ptr,speed:Float) This will be called when entity0 collides with another entity. The first entity is always the one which the callback was specified for. Note that the function can have any name. See the examples page for more info. [Examples] http://www.leadwerks.com/wiki/index.php?title=Entities Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Andr3wHur5t Posted August 6, 2010 Author Share Posted August 6, 2010 alright, also could you tell me how to share the data between the collision callback and my main loop i have tried some of my methods without success. thanks. Quote Tools: AC3D | 3D Canvas(pro) | Texture Maker(pro) | Genetica(basic) | 3D World Studio | Fragmotion |Leadwerks 2 | XNA 4 | Visual Studio 2010 Professional | XCode 5.x |UU3D Pro Programing & Scripting Languages: C |C++ | C# | Obj-C | LUA | Javascript | PHP | Ruby Link to comment Share on other sites More sharing options...
Joh Posted August 9, 2010 Share Posted August 9, 2010 What do you mean exactly? You could use a public variable in your main loop.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Andr3wHur5t Posted August 9, 2010 Author Share Posted August 9, 2010 I need to know what entity1 and entity0 are so I can compare them to see if one of them is a trigger body and the other is the environment or player inside my main loop. also: when you say public variable you mean created outside of created main loop and callback then initialized in one of them? Quote Tools: AC3D | 3D Canvas(pro) | Texture Maker(pro) | Genetica(basic) | 3D World Studio | Fragmotion |Leadwerks 2 | XNA 4 | Visual Studio 2010 Professional | XCode 5.x |UU3D Pro Programing & Scripting Languages: C |C++ | C# | Obj-C | LUA | Javascript | PHP | Ruby Link to comment Share on other sites More sharing options...
Pixel Perfect Posted August 9, 2010 Share Posted August 9, 2010 when you say public variable you mean created outside of created main loop and callback then initialized in one of them? Exactly, the public variable will be visible to both so can be set by the callback and read by the main loop. Conversely, you could encapsulate your main loop within a 'game' class and have it reference a member variable. The member variable could be set by a public member function in the class which is called from the callback passing the value as a parameter. In this case the pointer to the 'game' class would be a public variable ensuring it's scoped to the callback function. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Joh Posted August 10, 2010 Share Posted August 10, 2010 Also don't forget that you could set key and retrieve it in this way you don't need many public variable.. As for example: You create 5 trigger trap, you set a key like this "Type of entity" = 1 (1 trap, 2 ai, 3 player, 4..) , when 2 entity collide you can get the key, also you could set other value to them as for example the "effect" you need to reproduce. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Andr3wHur5t Posted August 17, 2010 Author Share Posted August 17, 2010 Pixel Perfect could you post an example for me of this? Quote Tools: AC3D | 3D Canvas(pro) | Texture Maker(pro) | Genetica(basic) | 3D World Studio | Fragmotion |Leadwerks 2 | XNA 4 | Visual Studio 2010 Professional | XCode 5.x |UU3D Pro Programing & Scripting Languages: C |C++ | C# | Obj-C | LUA | Javascript | PHP | Ruby Link to comment Share on other sites More sharing options...
Rick Posted August 17, 2010 Share Posted August 17, 2010 If you are using C++ then it's a nice feature to use SetEntityData and GetEntityData, where you assign your class to the entity so you can retrieve it in the collision method. 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.