| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 6,631
» Latest member: s8jpncom
» Forum threads: 2,468
» Forum posts: 12,502
Full Statistics
|
| Online Users |
There are currently 314 online users. » 0 Member(s) | 310 Guest(s) Bing, Applebot, Google, Yandex
|
| Latest Threads |
Qawno for macOS — native ...
Forum: Releases
Last Post: Xyranaut
Yesterday, 07:20 PM
» Replies: 0
» Views: 23
|
rust-samp 3.0.0 Released
Forum: Libraries
Last Post: NullSablex
Yesterday, 05:34 PM
» Replies: 0
» Views: 24
|
Open Pawn — Cross-platfor...
Forum: Releases
Last Post: Xyranaut
Yesterday, 02:09 PM
» Replies: 0
» Views: 24
|
Dołącz do ekipy projektu ...
Forum: Ogólne
Last Post: Sztakier
2026-05-27, 01:30 PM
» Replies: 0
» Views: 57
|
engkqSelections.inc
Forum: Libraries
Last Post: Engkq
2026-05-27, 02:58 AM
» Replies: 0
» Views: 82
|
FCNPC for open.mp - the c...
Forum: Plugins
Last Post: Xyranaut
2026-05-26, 01:26 AM
» Replies: 0
» Views: 71
|
🚀 ¡Buscamos Mapeador para...
Forum: Discusión GTA SA Multijugador
Last Post: Dramack
2026-05-25, 05:34 PM
» Replies: 0
» Views: 60
|
Welcome to los santos !
Forum: Advertisements
Last Post: xInVinCiBlE
2026-05-25, 10:00 AM
» Replies: 0
» Views: 80
|
RevolutionX DM/Stunt/Race...
Forum: Advertisements
Last Post: CJ101
2026-05-24, 04:30 PM
» Replies: 0
» Views: 59
|
How to transfer my server...
Forum: Support
Last Post: Telzin2k
2026-05-24, 03:13 PM
» Replies: 1
» Views: 94
|
|
|
| Math: vertical viewing angle |
|
Posted by: Freaksken - 2019-07-15, 08:18 PM - Forum: Pawn Scripting
- Replies (4)
|
 |
I have a system in which I've worked out the code for giving an NPC a horizontal viewing angle (left image). How would I achieve a similar result, but now for the vertical direction (right image)?
![[Image: viewing_angle.png?raw=1]](https://www.dropbox.com/s/tl2biem7emg13be/viewing_angle.png?raw=1)
Below is the code for the left image, for reference. This is a math question, thus the code isn't really necessary, but might help you understand the problem. Just ignore that the angles start from the NPC's center instead of his eyes, that's easy enough to fix. As you can see, the z-position is irrelevant for the horizontal viewing angle, but probably not for the vertical viewing angle (not sure).
PHP Code: static bool:FAI_IsPlayerInAggroViewingAngle(playerid, npcid) { // Get NPC position new Float:xn, Float:yn, Float:zn; FCNPC_GetPosition(npcid, xn, yn, zn);
// Get player position new Float:xp, Float:yp, Float:zp; if(!IsPlayerNPC(playerid)) { GetPlayerPos(playerid, xp, yp, zp); } else { FCNPC_GetPosition(playerid, xp, yp, zp); }
// Calculate the angle between these 2 points new Float:angleBetweenPoints = atan2(xp - xn, yp - yn);
// Get the NPC facing angle adjusted for the weird GTA angle system new Float:npcFacingAngle = 360.0 - FCNPC_GetAngle(npcid);
// Calculate the smallest difference between these 2 angles as a value between -180.0 and 180.0 new Float:angleDifference = angleBetweenPoints - npcFacingAngle; if(angleDifference > 180.0) { angleDifference -= 360.0; } if(angleDifference < -180.0) { angleDifference = 360.0; }
// Get the absolute value of this angle angleDifference = floatabs(angleDifference);
// Check if the player is within the aggro viewing angle if(angleDifference <= FAI_NPCs[npcid][FAI_NPC_AGGRO_VIEWING_ANGLE][playerid]/2) { return true; } return false; }
Here's another visualisation of what the result should look like:
|
|
|
|
| A weird problem with includes |
|
Posted by: mouiz - 2019-07-14, 01:00 PM - Forum: Pawn Scripting
- Replies (7)
|
 |
Quote:#include <../../gamemodes/modes/mode_robbery.pwn>
#include <../../gamemodes/modes/mode_dogfight.pwn>
These are ^ two includes in the 'gamemodes/modes' folder.
If i arrange them like this:?
Quote:#include <../../gamemodes/modes/mode_dogfight.pwn>
#include <../../gamemodes/modes/mode_robbery.pwn>
the 'mode_dogfight' works (gets included)?and the second one is ignored (it shows undefined symbol errors since the definitions of the functions are in the include)
If i arrange them oppositely then the 'mode_robbery' works, the second one is ignore.
How can i fix this?
|
|
|
|
| What would you start? |
|
Posted by: mouiz - 2019-07-12, 07:42 AM - Forum: Life
- Replies (5)
|
 |
If you had 100-500$ to start something profitable, what would it be ? Take it as a challenge ..
|
|
|
|
| Streamer |
|
Posted by: Jimmy - 2019-07-10, 06:18 AM - Forum: Questions and Suggestions
- Replies (5)
|
 |
Now that Streamer by Incognito is available as open source, add that (as is or improved version to fit Open.MP) as default streamer.
|
|
|
|
|