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

◆ ConstructionInsiderBoxCheck()

bool ConstructionInsiderBoxCheck ( PlayerBase player,
ConstructionPart part )
protected

Check character positioning with a box check (character must be inside at least one of the defined boxes)

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

843 {
844 const float CYLINDER_HEIGHT = 0.01;
845 const float CYLINDER_RADIUS = 0.01;
846
847 #ifdef DIAG_DEVELOPER
848 bool fullDebugEnabled = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_COLLISIONDEBUG);
849 if (fullDebugEnabled || (!fullDebugEnabled && m_InsideTestBoxes.Count() > 0))
850 DestroyDebugInsideTestBoxes();
851 #endif
852
854 if (!modelMinMaxs)
855 return true;
856
857 vector matPlayer[4];
858 Math3D.MatrixIdentity4(matPlayer);
859 vector adjustedPos = player.GetPosition();
860 adjustedPos[1] = adjustedPos[1] + CYLINDER_HEIGHT / 2;
861 matPlayer[3] = adjustedPos;
862
863 #ifdef DIAG_DEVELOPER
864 if (fullDebugEnabled)
865 {
866 if (m_PlayerInsideTestCylinder)
867 m_PlayerInsideTestCylinder.Destroy();
868 m_PlayerInsideTestCylinder = Debug.DrawCylinder("0 0 0", CYLINDER_RADIUS * 5, CYLINDER_HEIGHT, COLOR_YELLOW_A);
869 m_PlayerInsideTestCylinder.SetMatrix(matPlayer);
870 }
871 #endif
872
873 vector matParent[4];
874 m_EntityParent.GetTransform(matParent);
875 bool success = false;
876
877 foreach (array<vector> minMaxPair : modelMinMaxs)
878 {
879 vector min = minMaxPair[0];
880 vector max = minMaxPair[1];
881
882 bool playerInside = false;
883
884 //temporary test solution
885 playerInside = Math3D.IntersectCylinderOBB(min, max, matParent, matPlayer, CYLINDER_RADIUS, CYLINDER_HEIGHT);
886
887 if (playerInside)
888 {
889 success = true;
890 #ifdef DIAG_DEVELOPER
891 if (fullDebugEnabled)
892 {
893 DrawDebugInsideTestBox(min, max, ARGB(90, 128, 128, 128));
894 }
895 else
896 #else
897 return true;
898 #endif
899 }
900 #ifdef DIAG_DEVELOPER
901 else
902 {
903 if (fullDebugEnabled)
904 {
905 DrawDebugInsideTestBox(min, max, ARGB(90, 128, 0, 128));
906 }
907 }
908 #endif
909 }
910
911 #ifdef DIAG_DEVELOPER
912 if (fullDebugEnabled)
913 {
914 if (!success)
915 ConstructionDebug.SetInsideboxCheckDebugData(part.GetPartName());
916 else
917 ConstructionDebug.SetInsideboxCheckDebugData("");
918 }
919 #endif
920
921 return success;
922 }
EntityAI m_EntityParent
Определения ConstructionBase.c:45
array< ref array< vector > > TConstructionPartInsiderBoxData
Определения ConstructionPart.c:1159
DiagMenuIDs
Определения EDiagMenuIDs.c:2
string GetPartName()
Определения ConstructionPart.c:198
TConstructionPartInsiderBoxData GetInsiderBoxData()
translated MODELSPACE positions of min/max memory points (should be single points in memory LOD)
Определения ConstructionPart.c:172
static Shape DrawCylinder(vector pos, float radius, float height=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения 3_Game/DayZ/tools/Debug.c:411
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnDebug.c:241
Определения EnMath3D.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
const int COLOR_YELLOW_A
Определения 1_Core/DayZ/constants.c:74
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto bool IntersectCylinderOBB(vector mins, vector maxs, vector obbMat[4], vector cylMat[4], float cylinderRadius, float cylinderHeight)
Tests whether cylinder is intersecting oriented box.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Определения EnMath3D.c:256
int ARGB(int a, int r, int g, int b)
Определения proto.c:322

Перекрестные ссылки ARGB(), COLOR_YELLOW_A, Debug::DrawCylinder(), DiagMenu::GetBool(), ConstructionPart::GetInsiderBoxData(), ConstructionPart::GetPartName(), Math3D::IntersectCylinderOBB(), m_EntityParent и Math3D::MatrixIdentity4().