Jump to content

World:Pick explanation of code.


josk
 Share

Recommended Posts

From this code from Aggror's tutorial

 

if (self.entity.world:Pick(point1,point2,pickinfo,0,true,Collision.Prop))

 

Can someone explain what true is for, read the docs but cant make sense.

  • closest: if set to true, the closest intersection will be found, otherwise the operation will return as soon as a single intersection is found.

 

it's the intersection bit that confuses, wouldn't the closest intersection be the single intersection?

 

The cosde works fine its always good to know why things work.

Elite Cobra Squad

Link to comment
Share on other sites

When the closest detection is searched for, it is a slower test. Basically, each time a collision occurs, the line is shortened and it continues to test until a closer collision is found. This is good for projectiles, but if you're just doing a simple line of sight for AI or something, then it's a lot faster to pass false in this parameter. However, this will not return any useful info in the PickInfo position and normal fields.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...