TrailREndererJS Trail to moving object

animation

#1

Hi there!
I try to implement TrailRendererJS into my project:

But my result is very strange: choix.me/zhaw/industrie

Here is what I try:

// mienenspitze is the lead of the pen where the trail should be applied 
doTrail(mienenspitze);

function doTrail(target) {
        // specify points to create planar trail-head geometry
        var trailHeadGeometry = [];
        trailHeadGeometry.push(
                new THREE.Vector3(-10.0, 0.0, 0.0),
                new THREE.Vector3(0.0, 0.0, 0.0),
                new THREE.Vector3(10.0, 0.0, 0.0)
        );
        // create the trail renderer object
        trail = new THREE.TrailRenderer(scene, false);
        // create material for the trail renderer
        var trailMaterial = THREE.TrailRenderer.createBaseMaterial();
        // specify length of trail
        var trailLength = 15;
        // initialize the trail
        trail.initialize(trailMaterial, trailLength, false, 0, trailHeadGeometry, target);
        trail.activate();
    }

and in the animation loop i have this simple rotation:

   //pen is the whole pen, "mienenspitze" is a child of pen
    pen.rotation.y += (PIseconds * 0.00000003 ) / 10000000;
    pen.rotation.x += (PIseconds * 0.00000002 ) / 10000000;
    trail.advance();

Any ideas why this doesn’t work? Tried it also with a simple cube… also the same rotation animation - same strange behaviour.