# Help needed with generating spawn coordinants - Flash CS3

**URL:** <https://forum.kirupa.com/t/help-needed-with-generating-spawn-coordinants-flash-cs3/303099>\
**Category:** flash\
**Created:** [January 14, 2010, 12:19am UTC](https://forum.kirupa.com/t/help-needed-with-generating-spawn-coordinants-flash-cs3/303099 "2010-01-14T00:19:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent0](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vincent0](https://forum.kirupa.com/u/Vincent0)\
**Post date:** [January 14, 2010, 12:19am UTC](https://forum.kirupa.com/t/help-needed-with-generating-spawn-coordinants-flash-cs3/303099/1 "2010-01-14T00:19:50Z")

</div>

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.

```php
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](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](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.
