Jump to content

Line of sight detection.


Kopalov

Recommended Posts

Hello everyone.

I'm still learning C# and am very new to LSPDFR, so I wonder if there is a way to determine whether a nearby ped/vehicle is in my character's line of sight or not. For example if I want to get all game-created vehicles in 100f and make an array of them, can I sort out visible ones?

Edited by Kopalov
Link to comment
Share on other sites

On 8.3.2017 at 1:06 AM, Kopalov said:

Hello everyone.

I'm still learning C# and am very new to LSPDFR, so I wonder if there is a way to determine whether a nearby ped/vehicle is in my character's line of sight or not. For example if I want to get all game-created vehicles in 100f and make an array of them, can I sort out visible ones?

 

On 8.3.2017 at 5:44 PM, ToastinYou said:

LOS (Line of Site) natives will do the trick. Here is an example of one;

http://www.dev-c.com/nativedb/func/info/FCDFF7B72D23A1AC#fntrg-fcdff7b72d23a1ac

 

As these are pretty resource hungry, what I do is to check distance first and then use the natives. And also, I perform the check in a seperate gamefiber that waits for 200 ms after every check. That way, from a the player's perspective it is still relatively fluid and realistic while also reducing resource usage by checking only five times per second as opposed to 60.

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.

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.



×
×
  • Create New...