Advertisement

How do you trace a line

Started by June 12, 2003 11:19 AM
0 comments, last by UponTheEnd 21 years, 8 months ago
I am not sure if this is what i need but my problem is, i have an object, and i want to see if it can see another object, i was thinking about tracing a line from the center of the object through the scnery and seeing if it collides with anything, if it does, then i can see the other object beacuse it is being blocked from view. So do i need to trace a line to do this or are there other ways? Also if i do need to trace a line, how do i do that, i was told awhile ago that using a for loop is very bad for the program and there is a pure mathematical way to do it, which is what i wnat to know. Thanks alot
"What we do in life, echos in eternity" -- Gladiator
Have you checked this from here? It shows how to detect if a line pierces a polygon. Look at 3DMath.cpp especially in IntersectedPolygon()

But let's say you checked everything for collision and found that something closer than the target object is in the way... does that mean you can't see it? Well if the target is 1 point in size then yes, but otherwise there is a chance you can see part of it.

So assume you can see within a frustrum and check out this then this then this and maybe you'll then be able to find a quick way to do it.

Now if you are trying to figure out this for enemy AI, then you might make some assumptions like:
- skip moving creatures or objects (in other words, you can't hide behind a fan or in a herd of moving cows)
- skip transparent objects (you can only hide behind really dark shades )
- awareness of anything upwind within D1 distance (they can smell you if you get too close, even if sneaking behind them)
- awareness of anything that is moving within D2 distance (they can hear you move)
- awareness of anything that fires a missile within any distance (hearing or they can tell by the trajectory where it came from)
- awareness of your recent path (tracking)
- group awareness (if his buddy can see you, then he is also aware of your presence)
- awareness of anything they've already seen within S seconds

Hope that helps.


-solo (my site)

[edited by - 5010 on June 12, 2003 1:14:35 PM]

[edited by - 5010 on June 12, 2003 1:14:57 PM]
-solo (my site)

This topic is closed to new replies.

Advertisement