Game Development Community

Drawing a Line - Take 2

by Jacob S. · in Torque 3D Professional · 05/12/2010 (9:59 am) · 6 replies

I've been using debugDraw to draw lines and then deleting the debug object to delete the lines. (Memory Leak I Know) www.torquepowered.com/community/forums/viewthread/114859/1#comment-745591

But I've hit the wall with limitations, debugDraw doesn't return an ID on creating a line nor have I seen a way of raycasting to select them.

What I'm doing with them is creating a visual path for AI Characters to follow. As they follow the path (not a real path but a set of AI Tasks) I'd like the sections they completed to disappear.

I know others have had to do things similar to this in the past and I'm looking for a push in the right direction.

I thought of doing this with decals but alas decals have to be square... atm I'm at a bit of an impass.

Thanks in Advance.

#1
05/12/2010 (11:00 am)
Is your AI following path markers? If so you should be able to modify the path marker in c++ to draw a line or even a 3d marker to the next marker when they enter it and remove the previous one. Could you tell us what the overall effect you are trying to accomplish is?
#2
05/12/2010 (11:14 am)
True paths were to limiting so I instead went with a set of movement tasks for the AI.

As the player selects locations it creates a "line" from the prior point to the chosen point. The same points are also sent to the AI character to create pusedo paths. The player can create as many "lines" as they wish then they hit the play button and the AI follows the created lined pusedo path. What I'd then like to happen is then as they follow the path. The "lines" then disappear as they move across them.

I've modified the AI side of things so it's more reliable but debugDraw doesn't seem to allow me to only delete one "line" of the path.
#3
05/12/2010 (11:24 am)
What I would suggest then is to create a new scene object that you can pass the id of another scene object. Then the scene object can handle all of your line rendering and all you have to do is clean up the scene objects when the AI has passed them. You could also design it to automatically create in between markers to follow the terain from point A to point B. Looking at them path and marker code is a good place to start for only client side rendering of a scene object.
#4
05/12/2010 (11:52 am)
So you're suggesting to have seprate debugDrawers and ecapsulate those inside of scene objects? Then I would delete the indvidual scene objects to delete the lines.

Sounds do-able, researching.

Thanks :)
#5
05/12/2010 (11:57 am)
I you search for pathmarker in worldeditor.cpp you will see how they render the lines between markers.
#6
05/12/2010 (12:03 pm)
Researching...