Jump to content

redditing

Recommended Posts

Posted

Is there a way to check for collisions where the player is looking without aiming the gun as if the getWorldFromScreenPosition and GetPedTargetCollision functions were combined?

Posted (edited)

yes getWorldFromScreenPosition just above player head, and processLineOfSight should do, fill the params with player for start coords and a bit of offset (like 1 or 2 meters) to evade the ray hitting the player itself, and getWorldFromScreenPosition for end coord, you can customize others params to your needs.

something like:

local wordx,worldy,worldz=getWorldFromScreenPosition(...

local hitornot,hitx,hity,hitz=processLineOfSight(playerx,playery,playerz,worldx,worldy,worldz)

Edited by _Ace
  • Thanks 1
Posted
14 hours ago, _Ace said:

yes getWorldFromScreenPosition just above player head, and processLineOfSight should do, fill the params with player for start coords and a bit of offset (like 1 or 2 meters) to evade the ray hitting the player itself, and getWorldFromScreenPosition for end coord, you can customize others params to your needs.

something like:

local wordx,worldy,worldz=getWorldFromScreenPosition(...

local hitornot,hitx,hity,hitz=processLineOfSight(playerx,playery,playerz,worldx,worldy,worldz)

Thanks, man, that was exactly what I missed

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...