Alright! My hero is getting there. I've got some neat things going on, with even more possibilities spouting in my mind. However I've still got a few things I need some clarification with.
Here are my results thus far...
What is going on in the picture? - on keydown you fire 12 successions of 4 missiles. One of each pointing 'forward', 'backward', 'left', and 'right'. I did this by...Adding an additional variable passed to make_rocket. It now looks like this - make_rocket(id,icmd,iarg1,antimissile,directi ontype). Then I added this code.
Code:
if (directiontype == 1)
{
fl_iNewVelocity[0] = fl_iNewVelocity[0]/24
fl_iNewVelocity[1] = fl_iNewVelocity[1]/24
fl_iNewVelocity[2] = 800.0
}
else if (directiontype == 2)
{
fl_iNewVelocity[0] = fl_iNewVelocity[0]/-24
fl_iNewVelocity[1] = fl_iNewVelocity[1]/24
fl_iNewVelocity[2] = 800.0
}
else if (directiontype == 3)
{
fl_iNewVelocity[0] = fl_iNewVelocity[0]/-24
fl_iNewVelocity[1] = fl_iNewVelocity[1]/-24
fl_iNewVelocity[2] = 800.0
}
else if (directiontype == 4)
{
fl_iNewVelocity[0] = fl_iNewVelocity[0]/24
fl_iNewVelocity[1] = fl_iNewVelocity[1]/-24
fl_iNewVelocity[2] = 800.0
}
else
{
fl_iNewVelocity[0] = fl_iNewVelocity[0]/24
fl_iNewVelocity[1] = fl_iNewVelocity[1]/24
fl_iNewVelocity[2] = 800.0
}
This is moderately what I was going for. When you spin while doing this, it makes almost a perfect double helix. Which is neat. However - when you stand still and fire, ideally it should make a perfect box. But depending on which direction you stand when you shoot, sometimes the missiles draw extremely close to each other. It's like the value is too close to 1 or 0 - so when its bouncing the direction vector on x or y between between positive and negative, the change therefore is negligable, the missiles only draw far enough apart not to collide with one another.
Also! - I want to add at least another 4 cases, to account for 'forward-right', 'forward-left', 'back-right', and 'back-left'. How can I do this? I cannot for the life of me figure out how they come up with the number that explains the vector. I used some client output to debug what a vector number looks like and I can't make sense of it. Here are some vecs =/
Code:
[SH](Armageddon): fl_iNewVelocity[0]=1084819239, fl_iNewVelocity[1]=-1044238900
[SH](Armageddon): fl_iNewVelocity[0]=1097728794, fl_iNewVelocity[1]=-1046534568
[SH](Armageddon): fl_iNewVelocity[0]=1103425955, fl_iNewVelocity[1]=-1068217565
[SH](Armageddon): fl_iNewVelocity[0]=1102984338, fl_iNewVelocity[1]=1088830518
[SH](Armageddon): fl_iNewVelocity[0]=1096640857, fl_iNewVelocity[1]=1101334531
[SH](Armageddon): fl_iNewVelocity[0]=1085292137, fl_iNewVelocity[1]=1103218444
[SH](Armageddon): fl_iNewVelocity[0]=-1050281669, fl_iNewVelocity[1]=1101140955
[SH](Armageddon): fl_iNewVelocity[0]=-1045846265, fl_iNewVelocity[1]=1095694415
[SH](Armageddon): fl_iNewVelocity[0]=-1043963392, fl_iNewVelocity[1]=1069164112
[SH](Armageddon): fl_iNewVelocity[0]=-1044312471, fl_iNewVelocity[1]=-1061389409
[SH](Armageddon): fl_iNewVelocity[0]=-1054178281, fl_iNewVelocity[1]=-1045200546
[SH](Armageddon): fl_iNewVelocity[0]=-1074592246, fl_iNewVelocity[1]=-1043979152
I guess I'm wondering what I can do to control the direction more precisely by changing the velocity - only I have no clue what to do to the velocity to make this happen.
This is also neat, when you fire a laser missile its starting vector is straight up, instead of forward. How could I give it a jolt backward and up?
Thanks in advance,
-helium