Help needed with generating spawn coordinants - Flash CS3

I learned 3D math from the tutorial on this site. I have since developed a game where you are a spaceship flying through a star field. However, I have one problem. I can get the new planets to be created based on your position, but I can’t get them to change based on your angle. this makes it so they don’t spawn in front of you, they spawn off in a parallel line.

if(_root.halt == false){
		_root.score = getTimer()-startTime+scoreholder;
		if(getTimer()-currentTime>=_root.spawnTime){
			num++;
			_root.planetType = planets[Math.round(Math.random()*3)];
			attachedObj = theScene.attachMovie(_root.planetType, _root.planetType+num, num); 
			attachedObj.x = cameraView.x + Math.cos(rota-.5+Math.random())*Math.random()*1000;
			attachedObj.y = 0;
			attachedObj.z = cameraView.z + Math.sin(rota-.5+Math.random())*2000;
			attachedObj.display = displayFigure;
			objectsInScene.push(attachedObj);
			attachedObj._visible = false;
			currentTime = getTimer();
		}
	}

That is the section that I am using to generate new objects mid-flight.
http://www.kirupa.com/developer/actionscript/3dindex.htm
That is where the tutorial I learned from is.
http://www.kirupa.com/developer/actionscript/more_panning.htm
That is the exact example I am using the base code from. Thank you in advance for any help, I’ve put a lot of time into this and I only have one other thing to fix.