Intelligent Lines

 
This example combines turtle functions and boundary testing to create 'intelligent' growing lines.


/*

This script combines the turtle function (aa_turtle.mel) and the boundary testing functions (aa_isInside.mel) to create 'intelligent' lines that are capable of growing using object avoidance tactics.

To use this you need to make an environment of cubes and group them together, name the group "group1".

IMPORTANT: This script requires 'aa_turtle.mel' and 'aa_isInside.mel' from the script library.
*/

$spiral = aa_turtle_newturtle("CURVE");
$i = 1;
aa_turtle_setDirection($spiral,270,30);

while ($i < 400) {
// Go forward and turn
$junk = aa_turtle_getPosition($spiral);
print($junk[0]);
print("\n");

if(aa_isInsideGroup("group1",$junk[0],$junk[1],$junk[2]) == 1){
aa_turtle_turn($spiral,60,50);
}
aa_turtle_move($spiral,($i * 5));
aa_turtle_turn($spiral,10,0);

// Increase Counter
$i = $i + 1;
}







  • Intelligent Lines