gamecreator Posted August 21, 2011 Share Posted August 21, 2011 Is there a way to instantly know if two entities or two bodies are colliding without using EntityCollisionCallback? I'm trying to do something like this: // Move entity forward 2 spaces PositionEntity(entity1,Vec3(2,0,0),1); // If it collides with something if(EntitiesAreColliding(entity1,entity2)) { // Move entity forward 1 space PositionEntity(entity1,Vec3(1,0,0),1); // If it still collides with something if(EntitiesAreColliding(entity1,entity2)) { // Don't move entity PositionEntity(entity1,Vec3(0,0,0),1); } } Quote Link to comment Share on other sites More sharing options...
Canardia Posted August 21, 2011 Share Posted August 21, 2011 Just make your own EntitiesAreColliding function which checks from a STL map, which is populated by the EntityCollisionCallback function, if the two entities are colliding. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
gamecreator Posted August 21, 2011 Author Share Posted August 21, 2011 Thanks. Quote Link to comment Share on other sites More sharing options...
Rick Posted August 22, 2011 Share Posted August 22, 2011 Just curious, but why do you want to do that? You should be able to get the same type thing using the callback. Quote Link to comment Share on other sites More sharing options...
Josh Posted August 22, 2011 Share Posted August 22, 2011 The reason the engine doesn't store a list of collisions is because it can result in hundreds of dynamic allocations of memory each physics update, most of which will be unneeded. 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...
gamecreator Posted August 22, 2011 Author Share Posted August 22, 2011 I'm manually checking if the character can move forward, or up a hill, or down a hill or if it bumps into a wall. Let's say I need to move the character over 10 spaces this frame. I first check if it can move over 1 space. If it can, I move it. Then I check the next space. So on. I think it would be a waste to use EntityCollisionCallback because I would have to pass it dozens of possible situations, each through an individual (so dozens) of entities, if I understand its use correctly. I'm probably doing this the hard way though. 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.