ah, Thank you.
one good turn deserves another:<SNIPPED>
Hi KevL,
I decided to expand the fov to allow a return of more what the player can "see" on the screen rather than the PC. The figure of "100" was reached by trial and error, but felt like it gave the best results of "maximum catch" of creatures on screen and prevent those "behind" that caused the problem. Let me know if you have any different results that may be good to know.
Thanks for knocking out the function. Saved me having to play around with vectors ... they take me a while to work out where they start from.
EDIT: I may even try increasing the figures further to find the "sweet spot" to get best all around results without the "floating above" of those behind. I think "110" may be the max.
EDIT 2: Alternatively, is there a way to calculate fov from the perspective of the "player" as they view the screen? I ask this because a PC can be looking one way, while the player is looking another. i.e. Can the same functions be used to compensate/correct the current fov values to that of the player? I think access to the player's perspective is rather limited, although I know it can be done with respect to VFXs. I started looking at the "camera" functions, but not sure if they still work in NWN2.
Lance.
int GetIsInFoV(object oCreature, object oPC = OBJECT_SELF)
{
vector vPC = GetPosition(oPC);
vector vCreature = GetPosition(oCreature);
vector vDiff = vCreature - vPC;
float fDiff = VectorToAngle(vDiff);
float fPC = GetFacing(oPC);
fDiff -= fPC;
// these are the bounds, in degrees, to left and right of
// PC's current facing that return either Seen or NotSeen:
if (fDiff > 110.f || fDiff < -110.f)
{
return FALSE;
}
return TRUE;
}





Retour en haut






