Re: How to cast an ObstacleRay?
Code:
CastObstacleRay
Traces along a vector and returns the length of how far the trace went without hitting any non-ignored terrain material or MOID at all.
Arguments:
* The starting position.
* The vector to trace along.
* A reference to the vector screen will be filled out with the absolute location of the first obstacle, or the end of the ray if none was hit.
* A reference to the vector screen will be filled out with the absolute location of the last free position before hitting an obstacle, or the end of the ray if none was hit. This is only altered if thre are any free pixels encountered.
* An MOID to ignore. Any child MO's of this MOID will also be ignored.
* A specific material ID to ignore hits with.
* For every pixel checked along the line, how many to skip between them for optimization reasons. 0 = every pixel is checked.
Return value:
How far along, in pixel units, the ray the pixel of any obstacle was encountered. If no pixel of the right material was found, < 0 is returned. If an obstacle on the starting position was encountered, 0 is returned.
You're welcome.
Make sure to define the vectors first, or at least correctly inside the argument (it's generally easier to get your head around if they're done separately though).