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?