View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:18 am



Reply to topic  [ 4 posts ] 
 help checking for line of slight, and relevant functions 
Author Message

Joined: Tue Aug 03, 2010 4:51 pm
Posts: 32
Reply with quote
Post help checking for line of slight, and relevant functions
Tired of my flying saucer's turrets that shoot the terrain to try to get to the enemy actors behind a mountain, I'm going to attempt to add a line of sight check


I guess it would be something like this?


Code:
If hasTarget == true then
  if CastWeaknessRay(self.Pos, ShortestDistance(self.Pos, Target.Pos, true), 10, vector(0,0), 0, true) then
    fireWeapons()
  else
    acquireNewTargets()
  end
end



This is the API for the CastWeaknessRay Function, which requires a whopping 6 arguements,

Quote:
Traces along a vector and shows where along that ray there is an encounter with a pixel of a material with strength less than or equal to a specific value.

Arguments:

•The starting position.
•The vector to trace along.
•The strength value of screen any found to be equal or less than will terminate the ray.
•A reference to the vector screen will be filled out with the absolute location of the found terrain pixel of less than or equal to above strength.
•For every pixel checked along the line, how many to skip between them for optimization reasons. 0 = every pixel is checked.
•Whether the ray should wrap around the scene if it crosses a seam.
Return value:

Whether a material of equal or less strength was found along the ray. If not, the fourth parameter have been set to last position of the ray.

I have the following questions:
1.does The vector to trace along means vector from the starting position?
2.does strength value mean the structural integrity of the materials found in the ray?
3.what is the meaning of the fourth arguement, "A reference to the vector screen will be filled out with the absolute location of the found terrain pixel of less than or equal to above strength. ", and what should I put in for it?
4.last arguement "Whether the ray should wrap around the scene if it crosses a seam." takes in a boolean, right?
5.the function's return is a boolean, right?


Wed Sep 01, 2010 8:00 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: help checking for line of slight, and relevant functions
1. From the start, to the end. For example, the vector (0,5) would be used if the end was 5 pixels to the right of the start.

2. I think. Just set it at 0 and it'll stop at any kind of terrain.

3. Put a pointer to a vector there. The ray will dump the position of first contact into the variable or something like that.

4. Yes.

5. I believe so, yes.

Also, "ShortestDistance" should be "SceneMan:ShortestDistance".


Wed Sep 01, 2010 11:20 pm
Profile

Joined: Tue Aug 03, 2010 4:51 pm
Posts: 32
Reply with quote
Post Re: help checking for line of slight, and relevant functions
Does this raytracing function detect only terrain, or would it detect atoms on the enemy actor as well?


Fri Sep 03, 2010 12:31 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: help checking for line of slight, and relevant functions
Only terrain. If you're only trying to detect terrain, you should just use a StrengthRay and set the max strength check thing to zero.


Fri Sep 03, 2010 9:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.062s | 14 Queries | GZIP : Off ]