## [code question] spawining along a line

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.

### [code question] spawining along a line

I am attempting to get every instance of BFGextra to spawn a line of actors between itself and the BFGball that spawned them, preferably a jagged line. I have been attempting to look this up but have thus far only found example code that included built in methods for doing some of the math (methods that zscript doesn't have)
Any help on this would be appreciated, even just pointing me towards a good tutorial/good example code would go a long way.

zrrion the insect
Like a fish in a child's hands.

Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

### Re: [code question] spawining along a line

Off the top of my head this ought to work with minor adjustments.
Code: Select all
`double ang = GetAngle(0,AAPTR_TARGET);double range2d = GetDistance(0, AAPTR_TARGET); double range3d = GetDistance(1, AAPTR_TARGET); double pit = atan2(range2d, self.z - target.z) //may need to reverse the z comparison, I forget the right order easilydouble sparsity = 10.0;for(int i = +; i <=  range3d/sparsity, i++){//use these for spawn function arguments instead and maybe add some randomization. The proper method would be real bezier curves but I can't into math that well.x = cos(ang) * cos(pit)*(sparsity*i);x = sin(ang) * cos(pit)*(sparsity*i);z = sin(pit) * (sparsity*i);}`

I think maybe a native railgun function could do the trick just as well, with custom spawnclass and a range limit of GetDistance(1, AAPTR_TARGET)

kodi
Proscrastinator

Joined: 06 May 2013