Following the example Path Management for CAAT I've came with my own solution to track my go karting races (work in progress):
var path = new CAAT.Path().
beginPath(382, 369).
addCubicTo(464, 361, 535, 366, 587, 354).
addCubicTo(652, 339, 640, 78, 572, 87).
addCubicTo(556, 89, 373, 85, 358, 96).
addCubicTo(322, 121, 323, 111, 273, 195).
addCubicTo(261, 215, 306, 265, 346, 252).
addCubicTo(378, 242, 466, 248, 474, 235).
addCubicTo(481, 224, 481, 211, 469, 202).
addCubicTo(443, 184, 384, 214, 379, 200).
addCubicTo(360, 141, 428, 142, 501, 133).
addCubicTo(573, 124, 567, 237, 579, 258).
addCubicTo(588, 274, 582, 314, 561, 316).
addCubicTo(546, 317, 224, 326, 209, 283).
addCubicTo(190, 228, 245, 168, 253, 141).
addCubicTo(270, 83, 209, 77, 194, 78).
addCubicTo(179, 79, 108, 81, 86, 107).
addCubicTo(50, 150, 59, 226, 59, 241).
addCubicTo(57, 364, 156, 368, 164, 369).
addCubicTo(179, 371, 390, 364, 376, 370).
closePath();
var pa = new CAAT.Foundation.UI.PathActor().
setBounds(0,0,800,600).
setInteractive(true).
setPath( path ).
setOnUpdateCallback(trackChangedCallback()).
setBackgroundImage(img1, true).
showBoundingBox(false);
var fish = new CAAT.Foundation.UI.ShapeActor().
setSize(15, 15).
enableEvents(false).
setCompositeOp('lighter').
setFillStyle('red');
var pb = new CAAT.PathBehavior().
setPath(path).
setFrameTime(0, 5751).
setCycle(true).
setAutoRotate(true, CAAT.PathBehavior.autorotate.LEFT_TO_RIGHT).
setTranslation(fish.width / 2, fish.height / 2);
fish.addBehavior(pb);
scene.addChild( pa );
scene.addChild(fish);
When moving the points around using the guides on PathActor I would like to get the new point coordinates to save on my file. I thought that would be possible using the setOnUpdateCallback
but the callback is not called when points get changed.
Any ideas on how to get the points new coordinates?