redditing Posted November 13, 2020 Share Posted November 13, 2020 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? Link to comment
_Ace Posted November 13, 2020 Share Posted November 13, 2020 (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 November 13, 2020 by _Ace 1 Link to comment
redditing Posted November 13, 2020 Author Share Posted November 13, 2020 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now