Author Topic: Missile Poly Dodging  (Read 958 times)

0 Members and 1 Guest are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Missile Poly Dodging
« on: May 01, 2010, 02:25:49 pm »
Hello guys, i am writing a missile script that uses angular calculations for targeting and poly dodging, but am having trouble with the latter. I simply cant think of a good way to implement poly dodging.

Here is what i have:

Code: [Select]
...
tara := atan2(ty-y,tx-x);

fr := raycast(x,y,x+cos(cura)*accuracy,y+sin(cura)*accuracy,fdst,accuracy*3);
rr := raycast(x,y,x+cos(cura-0.8)*accuracy,y+sin(cura-0.8)*accuracy,rdst,accuracy*3);
lr := raycast(x,y,x+cos(cura+0.8)*accuracy,y+sin(cura+0.8)*accuracy,ldst,accuracy*3);

movea := tara;

if not fr then begin
if (rr = false) OR (lr = false) then begin
movea := wrapvalue(movea + pi/2.0,-pi,pi,false);
accelleration := accelleration * maxturnspeed;
end;
end;

player[i].missile.vec := addpolarspeed(player[i].missile.vec,movea,accelleration);

...

(tx,ty) is the position of the target
(x,y) is the current position of the missile
tara is the angle from the missile to the target
movea is supposed to be the desired angle of motion

Does anyone have a good way to implement poly dodging?

Also, what is the distance paramater, second from last, in raycast() actually supposed to hold? It would make sense if it was the distance to the collision of the ray, but that doesnt seem to be so.

Thank you.

Edit: Main question solved, but the forum wont let me delete the thread, will an admin please delete it for me?
« Last Edit: May 01, 2010, 02:30:33 pm by Hacktank »


Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Missile Poly Dodging
« Reply #1 on: May 01, 2010, 02:33:56 pm »
Also, what is the distance paramater, second from last, in raycast() actually supposed to hold? It would make sense if it was the distance to the collision of the ray, but that doesnt seem to be so.
it's something random
http://forums.soldat.pl/index.php?topic=36644.0

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Missile Poly Dodging
« Reply #2 on: May 01, 2010, 02:55:41 pm »
Edit: Main question solved, but the forum wont let me delete the thread, will an admin please delete it for me?
Why would you delete a thread?

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Missile Poly Dodging
« Reply #3 on: May 01, 2010, 03:04:11 pm »
Because i pulled my head out of my arse less than 1 minute after posting this....

@dnmr: Well, its rather useless then isnt it <,<.