Pathfinding / Beams through walls?
Moderator: Moderators
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
Pathfinding / Beams through walls?
Has anyone been able to make func_beams appear through walls? Alwaysdraw doesn't work, it seems a trace is being done at the moment of activating the beam from origin to endpoint, and it stops at any solid found on the way. I tried tracing forward from inside the solid (endpoint + forward vector - this is 1 unit deep inside the wall), but the game refuses to do so and traces from the surface (where the beam endpoint is), which is useless, and as a result I get an error (either all edicts have been used or a command overflow). Any ideas?
Last edited by Rookie One.pl on Mon May 01, 2006 10:47 am, edited 1 time in total.
clip
Perhaps the beam will go through "player_clip". Then the walls could be nonsolid. You're not saying much about what it is for, but how about making a small hole in the wall?
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
I'm afraid I can't reveal much yet. It's for the project I wanted to use pathfinding for. My algorithm worked partially, but I encountered a bit of a problem (would be much easier if sighttracing returned the point hit) and scrapped the idea.
The thing is that I need to display a bot's path before they follow it, and beams would be perfect for it, if only they could be made to work like that (or a valid pathfinding algorithm was used).
The thing is that I need to display a bot's path before they follow it, and beams would be perfect for it, if only they could be made to work like that (or a valid pathfinding algorithm was used).
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
I think the picture below explains the pathfinding problem quite well.

While the sight trace fails because of the obstacle, the linear one succeeds. This is not a problem with larger obstacles (I can find a path e.g. around a corner), but quite an issue with smaller ones.
Why is this important? Here is an excerpt of my pathfinding script:

While the sight trace fails because of the obstacle, the linear one succeeds. This is not a problem with larger obstacles (I can find a path e.g. around a corner), but quite an issue with smaller ones.
Why is this important? Here is an excerpt of my pathfinding script:
Code: Select all
local.dest = $startnode.origin + (angles_toforward (local.ang + ( 0 local.i 0 ))) * local.dist * -1 // honestly I have no idea why this needs inverting :S
if (sighttrace $startnode.origin local.dest 0 ( -16 -16 18 ) ( 16 16 76 )) {
println "Found at offset " local.i
local.passages[local.pindex] = local.dest
local.pindex++
waitthread draw_beam ($startnode.origin + ( 0 0 32 )) (local.dest + ( 0 0 32 ))
break
} else {
local.dist = vector_length($startnode.origin - (trace $startnode.origin local.dest)) + 32
println "Distance updated to " local.dist
}-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
Ofcourse, although I can't really take credit for a Taylor expansionRookie One.pl wrote:Can I use your cosinus from Skylimit? You'll be credited, of course.
cos x ~ 1 - x^2 / 2! + x^4 / 4! - x^6 / 6! + x^8 / 8! - ...
Where x is in radians.
pi radians = 180 degrees.
The skylimit script takes x in radians, as well.
! denotes a factorial, e.g.
3! = 1x2x3 = 6
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:





