Game Development Community

Annoying problems with t2dPath objects created in TGB

by Richard Skala · in iTorque 2D · 05/26/2010 (11:39 pm) · 5 replies

I am using iTGB (v1.7.4) for MacOSX to create some t2dPath objects, but they are having several annoying issues.

First, the node order seems to be backwards. That is, when I place the nodes in the order I want the attached object to travel, and then attach the object during the game, the object travels along the path backwards.

Second, the node order seems unreliable. To compensate for the first problem, I tried creating the nodes in reverse order. The attached object then travels in the correct direction, but the first node (index 0) doesn't always seem to be the first node placed.

I know that I am using the 't2dPath::attachObject()' C++ function properly, as dynamic paths I've created in code have their nodes in the order I add them in.

Is there a way to force the order of the nodes through the editor? I don't see any useful control over t2dPaths besides changing the type and adding/removing nodes.

Has anyone else experienced this? Are there any solutions? Thanks for any help with this.




#1
05/27/2010 (1:19 am)
Haven't experienced that problem myself.

Here is a snippet of what I do if it helps:

%path = new t2dPath() {
		sceneGraph = %sceneGraph;
	        pathType = "CATMULL";
	};

	%path.addNode(%start, 0);
	%path.addNode(%node1x SPC %node1y, 1);
	%path.addNode(%node2x SPC %node2y, 2);

        // %this is the object that will be attached to the path
        %this.path = %path;
        %this.path.attachObject(%this, %this.maxSpeed, 1, 0, 2, "WRAP", 1, true);
	%this.path.setOrient(%this, false);
#2
05/27/2010 (11:54 am)
When I add the nodes manually like you are doing, the order is correct.

However, it's the t2dPath nodes that are created in the iTGB editor that are messed up. The node ordering is unpredictable, and as far as I can tell, there is no way to reorder them, which makes them basically unusable for my purposes here!
#3
05/27/2010 (11:56 am)
By the way, I don't know if it matters, but I'm using LINEAR paths.
#4
05/27/2010 (12:31 pm)
Please report it according to this format so that the QA and development teams can quickly and easily replicate it and get to squashing it.

Reporting format:
http://www.torquepowered.com/community/forums/viewthread/115183
#5
05/27/2010 (1:10 pm)
Thanks, I'll post the bug report now.