Paths in Torque X?
by Ian Poma · in Torque X 2D · 07/18/2007 (7:51 am) · 10 replies
Is there anything in Torque X that can replace the t2dPath object from TGB? Was this functionality removed and placed in the Platform Starter Kit?
About the author
#2
btw, torque X is pure awesome, thanks for all you guys have done.
07/24/2007 (9:02 pm)
Not the answer I was hoping for, but thanks for the reply :) btw, torque X is pure awesome, thanks for all you guys have done.
#3
09/08/2007 (7:16 pm)
That is still good to know for me though. Hope they come back in future versions.
#4
I don't see a method to find next collision point, but there is one to create a new point.
01/09/2008 (1:35 am)
I was wondering about this too. What if could be hacked in TBX. By using a new object in TXB and creating a colllision pollygon for it. Then make the object following the points in the collision polygon. Could it be done ? I don't see a method to find next collision point, but there is one to create a new point.
#5
01/09/2008 (1:36 pm)
Vishal, two problems here. First, I don't think you are gaurenteed the the same order of collision points you draw in TXB. Second, you are limited in what kind of paths you can make due to the convex shape limitation of the collision polygon. It would be much easier to use blanksceneobjects of certain object type and build a curve from their positions.
#6
01/10/2008 (11:49 am)
True. I guess adding objects should be best call. Has anyone done it yet ?
#7
www.garagegames.com/mg/forums/result.thread.php?qt=70557
This is very basic. His game only needed one path per level. You can take it a step further by having the pathing component hold a list of its path nodes only, and then one more step by creating a curve to follow instead of straight lines.
01/10/2008 (12:47 pm)
I've helped someone do straight line paths between nodes. I'll link the thread...www.garagegames.com/mg/forums/result.thread.php?qt=70557
This is very basic. His game only needed one path per level. You can take it a step further by having the pathing component hold a list of its path nodes only, and then one more step by creating a curve to follow instead of straight lines.
#8
07/19/2008 (7:20 am)
Sorry for bringing this up again, but i need multiple paths for each level. I tried using link points on a huge TXscene object, but the position seems to be small in comparision to the distance i put them. eg i put it right at the corner of the Sceneobject but it still gives me a small value. What gives ?
#9
07/19/2008 (10:26 am)
A link point in the exact bottom right corner of something would have the value (1,-1) and the top right corner of an object would be (1,1) whereas a link point in the center of an object is (0,0) so if you want the "point" of the link point with the origin being the center of the object, you'd do x = (objectWidth/2)*linkPoint.x and y = (objectHeight/2)*linkPoint.y
#10
anyway here is some code that will give an order list. ie path.
It's a shame that the link points don't seem to flip when the sceneobject is flipped
07/19/2008 (3:03 pm)
Thanks for letting me know. Finding the width and height of the scene object was harder than i ever imaged!!anyway here is some code that will give an order list. ie path.
//The only thing it requires it the SceneObject that has all the link points attached to it
//Returns an order list of points. That can be used for paths and other stuff
bool end = false;
int i = 1;
float linkRotation;
Vector2 linkPosition;
List<Vector2> array = new List<Vector2>();
while (!end)
{
String linkPointName = "LinkPoint" + i;
i++;
if (maker.LinkPoints.HasLinkPoint(linkPointName))
{
maker.LinkPoints.GetLinkPoint(linkPointName, out linkPosition, out linkRotation);
float x = (maker.WorldClipRectangle.Width / 2) * linkPosition.X;
float y = (maker.WorldClipRectangle.Height / 2) * linkPosition.Y;
array.Add(new Vector2(x, y));
}
else
{
end = true;
}
}It's a shame that the link points don't seem to flip when the sceneobject is flipped
Torque Owner Thomas Buscaglia