Horde3D http://horde3d.org/forums/ |
|
Need to know how can i make my character follow a path http://horde3d.org/forums/viewtopic.php?f=6&t=1402 |
Page 1 of 1 |
Author: | imranhabib [ 14.02.2011, 17:17 ] |
Post subject: | Need to know how can i make my character follow a path |
Hello Evry 1 this is Imran and I am new to Horde3d! started a week ago, learnt character control from the tutorials given on the horde3d http://mm-werkstatt.informatik.uni-augsburg.de/projects/GameEngine/doku.php/docs and have got some idea how to control a character ... My Question is simple and straight forward .. i can control "Hans" and "Marie" with mouse and keyboard but I have to make one of the characters to follow some path and then make the other to chase it , what can be simplest possible solution to this kindly help do remember i am very new to horde3d ... I will be thankful to any 1 of u who will help Regards Imran Habib |
Author: | vikingcode [ 17.02.2011, 05:38 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
Quote: I have to make one of the characters to follow some path and then make the other to chase it , what can be simplest possible solution to this You have to code the path algorithm and make the 1st character follow that. To make the other (2nd) character chase, it's up to you how to perform it. Every update, you could get the position of the 1st character that is following the path, and make the 2nd character follow a path directly from his current position to the 1st character position. You could choose to only change direction every so many loops. You could do it however you want! If there are obstacles it becomes more complex. |
Author: | imranhabib [ 17.02.2011, 14:36 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
vikingcode wrote: Quote: I have to make one of the characters to follow some path and then make the other to chase it , what can be simplest possible solution to this You have to code the path algorithm and make the 1st character follow that. To make the other (2nd) character chase, it's up to you how to perform it. Every update, you could get the position of the 1st character that is following the path, and make the 2nd character follow a path directly from his current position to the 1st character position. You could choose to only change direction every so many loops. You could do it however you want! If there are obstacles it becomes more complex. Well ! First of all thank U for replying Secondly ! okay its good suggestion ! but i dun have a grid here i mean floor of my scene is not divided into a grid of specific size or may be i don't know coz i just started using horde3d 1 and a half week ago, is there anything i can let my character say move this much steps in forward direction and then turn left and then this much steps in forward again and so on etc .. i think simplest possible could b this but i dun know much about horde3d and its functions kindly direct me about it i will b sooper happy to get directions from u and wil honor and respect ur directions Regards Imran Habib |
Author: | vikingcode [ 17.02.2011, 17:23 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
I hope someone else can help because I don't know much about the Horde3D Game Engine. I am just starting to use Horde3D itself. Possibly, the game engine has some kind of plugin for AI or path finding. If not, you will have to code the AI to avoid obstacles etc. You don't need a grid. The scene graph is the grid. You would have to traverse the scene nodes and check against their bounding boxes to make sure you will not collide with them on your current path. When you find that you are going to collide, you have to recalculate a pathway around the obstacle using some kind of shortest path algorithm, then continue back on your main path. It's not easy. How early and how often you change direction can affect the efficiency and effectiveness of your algorithm. You could wait until you collide, but it is better to calculate check points so to speak. You could calculate a few way-points to get around an obstacle before you get too close. But you also must consider that the character you are following can change direction any time. It may be effective to update the 2nd characters path (towards the 1st character) every few cycles (or hundred cycles!), but whenever you find an obstacle that alters your path then focus only on getting around the obstacle by following your calculated way-points. Only start following the 1st character again once you are past the obstacle, or only follow the 1st character again if it changes direction (angle) by more than a certain amount. Also there may be some other libraries out there that can help with path finding. |
Author: | Irdis [ 18.02.2011, 11:27 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
Maybe this could help you - Recast Navigation |
Author: | imranhabib [ 18.02.2011, 20:47 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
Irdis wrote: Maybe this could help you - Recast Navigation firstly thanks well i liked that and got an idea how it would work and i think that's what i want but when i m downloading it and compiling tht its giving me sdl.h file missing which i don't have any idea where to find and where to copy ***************** do u have some idea if there is some function that counts number of foot steps etc or may be if i count foot steps then i can ask my character to take say 50 number of steps in forward and then move right and then take 50 forward and move right etc etc and then may be can make other one to follow her by controlling by keyboard i am thank full and will b thank full for future answers Regards Imran Habib |
Author: | imranhabib [ 18.02.2011, 20:57 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
vikingcode wrote: I hope someone else can help because I don't know much about the Horde3D Game Engine. I am just starting to use Horde3D itself. Possibly, the game engine has some kind of plugin for AI or path finding. If not, you will have to code the AI to avoid obstacles etc. You don't need a grid. The scene graph is the grid. You would have to traverse the scene nodes and check against their bounding boxes to make sure you will not collide with them on your current path. When you find that you are going to collide, you have to recalculate a pathway around the obstacle using some kind of shortest path algorithm, then continue back on your main path. It's not easy. How early and how often you change direction can affect the efficiency and effectiveness of your algorithm. You could wait until you collide, but it is better to calculate check points so to speak. You could calculate a few way-points to get around an obstacle before you get too close. But you also must consider that the character you are following can change direction any time. It may be effective to update the 2nd characters path (towards the 1st character) every few cycles (or hundred cycles!), but whenever you find an obstacle that alters your path then focus only on getting around the obstacle by following your calculated way-points. Only start following the 1st character again once you are past the obstacle, or only follow the 1st character again if it changes direction (angle) by more than a certain amount. Also there may be some other libraries out there that can help with path finding. Well Thank U so much ! I respect and appreciate the thing that u brought into consideration ! i have worked with some kind of grid but the things that u r letting me know are abit at bigger level then mine as i just started using horde3d not only horde 3d but also game engines , i never used any game engine before so that may be i should have idea about how to traverse nodes and etc anyways i m just new to it and may be that task takes abit or more longer time for begginer ... I have to show only character following a path , and i guess that easiest possible could be letting 1 move in one direction for some time and then taking a turn and then moving other with key board to catch other.. as i said to other friend that i can control both characters with key board but now its kind of making one to move automatically on a defined path so that the other one catches him after following him May be as i said counting number of steps and letting her move for say 50 steps forward and then moving left and again forward 50 steps and so on but for that i dun know how to count steps etc Regards Imran Habib |
Author: | Irdis [ 19.02.2011, 21:21 ] |
Post subject: | Re: Need to know how can i make my character follow a path |
imranhabib wrote: its giving me sdl.h file missing which i don't have any idea where to find and where to copy Sorry, I didn't use this system myself, as ai and pathfinding are not currently needed in my project. I browsed the source, it seems that only demo needs sdl, the system itself doesn't rely on it. I guess that in order to build the demo you would have to download sdl pack and configure your IDE with paths to SDL folder. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |