DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ MemPointDirectionalCheck()

static bool MemPointDirectionalCheck ( PlayerBase player,
EntityAI targetEnt,
string memPointStartName,
string memPointEndName,
float toleranceAngle = Math.PI_HALF )
staticprotected

Returns true when the player stands on the opposite side of memPointEndName relative to memPointStartName (angle exceeds toleranceAngle) Intentionally returns true (no restriction) when the check cannot be performed (missing player/entity or memory points) Callers where a failed check must deny access have to verify the preconditions (e.g. MemoryPointExists) themselves

См. определение в файле MiscGameplayFunctions.c строка 942

943 {
944 if (player && targetEnt && memPointEndName != "" && targetEnt.MemoryPointExists(memPointEndName) && memPointStartName != "" && targetEnt.MemoryPointExists(memPointStartName))
945 {
946 vector memPointEndPos = targetEnt.ModelToWorld(targetEnt.GetMemoryPointPos(memPointEndName));
947 vector memPointStartPos = targetEnt.ModelToWorld(targetEnt.GetMemoryPointPos(memPointStartName));
948 vector playerPosition = player.GetPosition();
949 vector playerHeadPos = MiscGameplayFunctions.GetPlayerHeadPosition(player);
950 vector playerDir = vector.Direction(playerHeadPos, memPointStartPos);
951 playerDir.Normalize();
952 vector memDir = vector.Direction(memPointStartPos, memPointEndPos);
953 memDir.Normalize();
954
955 /*
956 vector dbgPos = playerPosition;
957 Debug.DrawArrow(dbgPos, dbgPos + playerDir, 0.15, COLOR_YELLOW);
958 Debug.DrawArrow(memPointStartPos, memPointStartPos + memDir, 0.15, COLOR_GREEN);
959
960 Debug.DrawSphere(memPointStartPos, 0.05, COLOR_YELLOW, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE);
961 Debug.DrawSphere(dbgPos, 0.05, COLOR_RED, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE);
962 */
963
964 return GenericDirectionalCheck(playerDir, memDir, toleranceAngle);
965 }
966
967 return true;
968 }
static bool GenericDirectionalCheck(vector dir1, vector dir2, float toleranceAngle)
just compares the angle
Определения MiscGameplayFunctions.c:971
proto float Normalize()
Normalizes vector. Returns length.
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
Определения EnConvert.c:254
Определения EnConvert.c:119

Перекрестные ссылки vector::Direction(), GenericDirectionalCheck() и vector::Normalize().