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



Reply to topic  [ 3 posts ] 
 How to cast an ObstacleRay? 
Author Message
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post How to cast an ObstacleRay?
Arg can't find a working link to the wiki.

What are the arguments for casting an ObstacleRay?


Sun Dec 13, 2009 3:36 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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).


Sun Dec 13, 2009 7:15 am
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to cast an ObstacleRay?
Thanks.


Sun Dec 13, 2009 9:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.072s | 13 Queries | GZIP : Off ]