Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Check if player is facing Ped

Featured Replies

Hello all, I tried googling this before coming here, and did not find anything. Is there a way to determine if the player is facing a Ped? I am trying to create a RageUIMenu that becomes visible when the player is standing within 5m of a ped, and is facing them. I have the menu pretty much coded, just working on the Visible logic. Any and all help is appreciated!

I have used this code before to find the difference in heading between two entities:

float headingDiff = MathHelper.NormalizeHeading(object2.Heading - object1.Heading);

So you would want to check that the heading diff was about 180 (give it some +/- range), then also check your distance

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

  • Author
9 hours ago, PNWParksFan said:

I have used this code before to find the difference in heading between two entities:


float headingDiff = MathHelper.NormalizeHeading(object2.Heading - object1.Heading);

So you would want to check that the heading diff was about 180 (give it some +/- range), then also check your distance

 

Thanks man, I appreciate all your help!

  • Management Team

Depending on your needs, the following natives might also be helpful:

 

IS_PED_FACING_PED

_CAN_PED_SEE_PED (I believe this actually checks whether ped A has received an event that ped B has been spotted)

HAS_ENTITY_CLEAR_LOS_TO_ENTITY

HAS_ENTITY_CLEAR_LOS_TO_ENTITY_IN_FRONT

 

The last two are more expensive than the other ones as they perform a proper raytrace (e.g. buildings between two peds are taken into account which is not the case for heading checks).

 

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Management Team
17 minutes ago, Brexin212 said:

@LMS

 

So something like this? The documentation on this i very limited

 


if (NativeFunction.Natives.IS_PED_FACING_PED<bool>(player, p))
{
  // Logic
}

 

 

It takes one more parameter, the angle to check as a float.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

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...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.