Game Development Community

Problem with Paths

by Coolcajun · in Torque Game Builder · 05/27/2007 (9:13 pm) · 1 replies

I would like to create a path interactively and attach an object to the path and set it moving along the path.
I am having problems getting this to work. Here is a snippet of what I have so far

function BlockClass::onLevelLoaded(%this, %scenegraph)
{
if(%this.imageMap $= "PinkBlockImageMap")
{
$pinkPath = new t2dPath();
$pinkPath.addNode("0 0");
$pinkPath.addNode("20 20");

$pinkPath.attachObject(%this,10);
}
$BlockClass = %this;
}

#1
05/28/2007 (9:21 am)
You have to assign a scenegraph to the t2dPath

function BlockClass::onLevelLoaded(%this, %scenegraph)
{
$pinkPath = new t2dPath(){
scenegraph = %scenegraph;
};

Good luck! :)