1

Topic: [Help] CLaser Direction

Hello guys.
I wanted to create a Laser Turret.
It searchs for the closest Character within a range of 160.0f (dont know what unit, lol)
and fires off a Laser.
But.. Somehow it wont work, really. sad
Posted my code at pastebin.
Pastebin code of turret.cpp: http://pastebin.com/3U4qEur3



Hope you can help me ^^

Thanks guys.

2 (edited by KillaBilla 2012-02-26 19:17:34)

Re: [Help] CLaser Direction

The direction should be normalize(aimpos - startpos).

3

Re: [Help] CLaser Direction

k thnx :3

4

Re: [Help] CLaser Direction

best use:

if (length(aimpos-startpos) > 0.0f)
{
  vec2 Dir = normalize(aimpos-startpos);
  //Pichiummm!! Pichiumm!! AHHHHHH PRRRFFFFTTTT!!
}

5

Re: [Help] CLaser Direction

@idnk thanx. ill try that out.
@killabilla yesh. got it ^^.

@everybody else:
is there any way to get an "older position" of the client?!

as example:

Laser shots directly to the player (hits everytime...).
Laser shots to the players last known position (the one before current), or some older positions.
So that its like this:

     OldPlayer        Player
           ^
          /
        /
Laser

6 (edited by KillaBilla 2012-03-02 16:39:14)

Re: [Help] CLaser Direction

powachill4 wrote:

@everybody else:
is there any way to get an "older position" of the client?!

as example:

Laser shots directly to the player (hits everytime...).
Laser shots to the players last known position (the one before current), or some older positions.
So that its like this:

     OldPlayer        Player
           ^
          /
        /
Laser

Save the client's position and use it some ticks later, e.g.:

static vec2 oldpos(0,0);
if(servertick % 10 == 0) // every 1/5 second
    oldpos = currentpos;
firelaserto(oldpos);

7

Re: [Help] CLaser Direction

Okay thanks homo bro! Youre good help for me (thumps up tongue)!

8

Re: [Help] CLaser Direction

powachill4 wrote:

Okay thanks homo bro! Youre good help for me (thumps up tongue)!

big_smile