added 3d rotation and a trail length parameter