Lines and Bounding Boxes problem
Posted: Thu Aug 06, 2009 2:14 am
Hi, I'm trying to make a small waypoints guiding system for the NPCs in my game. I load some nodes called "waypoint" from the .irr file, save their positions, and I have a list with all the collidable objects in the scene, then I have a small algorithm to find the way form the NPC position to the player's position.
The problem is to check if the NPC has a clear path to the waypoint or the player.
I make this by building a line between both of them, and checking with the list of items if any of them are colliding with the line, the strange thing, is that the line collides with objects in a completely different place. I've checke that printing the name of the colliding item.
I have the feeling that the lines are being created with a different point of reference than the item's bounding box.
I know there are some already made libs for this, but it's for a college project, and making my own waypoint system will give me extra points...
Thanks in advance, and please tell me if I was not clear enough in my explanation.
The problem is to check if the NPC has a clear path to the waypoint or the player.
I make this by building a line between both of them, and checking with the list of items if any of them are colliding with the line, the strange thing, is that the line collides with objects in a completely different place. I've checke that printing the name of the colliding item.
I have the feeling that the lines are being created with a different point of reference than the item's bounding box.
I know there are some already made libs for this, but it's for a college project, and making my own waypoint system will give me extra points...
Thanks in advance, and please tell me if I was not clear enough in my explanation.