Posted By: SomebodyNew
rel. distances... vector(my.x, my.y, my.z) - 07/27/09 17:06
Hello everyone,
I wrote a script that lets the player fly an aircraft and shoot two missiles simultaneously from under its wings.
The script creates two "missile"-entities on the my.x, my.y etc coordinates +/- something (so that the missiles are created at the left and right ends of the aircrafts wings).
Now my first try looked like this (i left out all the unrelated code for a better overview):
The problem was that the two missiles where always created using axis-coordinates +/- 50 quants (absolut coordinates). So my question is if there is a way to use relative coordinates where 0,0,0 is the entities position?
(the problem is not the angle of the missiles, thats already done - they're always shot in the direction the player is facing).
I've been able to go around that problem using some awfull long formulas (sin/cos plus each entity's individual collision model). I'm sure however that lite-c offers a better way to do this. I've looked in the manual but have not found anything there.
Thanks for your time.
I wrote a script that lets the player fly an aircraft and shoot two missiles simultaneously from under its wings.
The script creates two "missile"-entities on the my.x, my.y etc coordinates +/- something (so that the missiles are created at the left and right ends of the aircrafts wings).
Now my first try looked like this (i left out all the unrelated code for a better overview):
Code:
function missiles() { ent_create("missile.mdl", vector(plAIR.x + 50,plAIR.y + 50,0), rocket); ent_create("missile.mdl", vector(plAIR.x - 50,plAIR.y + 50,0), rocket); wait(1); }
The problem was that the two missiles where always created using axis-coordinates +/- 50 quants (absolut coordinates). So my question is if there is a way to use relative coordinates where 0,0,0 is the entities position?
(the problem is not the angle of the missiles, thats already done - they're always shot in the direction the player is facing).
I've been able to go around that problem using some awfull long formulas (sin/cos plus each entity's individual collision model). I'm sure however that lite-c offers a better way to do this. I've looked in the manual but have not found anything there.
Thanks for your time.