Data Realms Fan Forums http://45.55.195.193/ |
|
help checking for line of slight, and relevant functions http://45.55.195.193/viewtopic.php?f=73&t=19654 |
Page 1 of 1 |
Author: | goduranus [ Wed Sep 01, 2010 8:00 pm ] |
Post subject: | 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? |
Author: | CaveCricket48 [ Wed Sep 01, 2010 11:20 pm ] |
Post subject: | 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". |
Author: | goduranus [ Fri Sep 03, 2010 12:31 pm ] |
Post subject: | 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? |
Author: | CaveCricket48 [ Fri Sep 03, 2010 9:11 pm ] |
Post subject: | 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. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |