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

◆ IsCollidingEx()

bool IsCollidingEx ( CollisionCheckData check_data)
protected

Collision check for building part.

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

1482 {
1484 return false;
1485
1486 ConstructionPart part = GetConstructionPart(check_data.m_PartName);
1487 if (part && part.GetCollisionData().Count() == 2)
1488 {
1489 vector center;
1490 float absoluteOfset = 0.05; //we need to lift BBox even more, because it colliddes with house floors due to various reasons (probably geometry or float imperfections)
1491 vector edgeLength;
1492 vector minMax[2]; //data used for creating trigger
1493 array<Object> excludedObjects = new array<Object>();
1494 array<Object> collidedObjects = new array<Object>();
1495
1496 excludedObjects.Insert(m_EntityParent);
1497 if (check_data.m_AdditionalExcludes.Count() > 0)
1498 {
1499 excludedObjects.InsertAll(check_data.m_AdditionalExcludes);
1500 }
1501
1502 GetCollisionBoxData(check_data.m_PartName, minMax);
1503 center = GetBoxCenter(minMax);
1504 center = m_EntityParent.ModelToWorld(center); //convert to world coordinates
1505 edgeLength = GetCollisionBoxSize(minMax);
1506
1507 #ifdef DIAG_DEVELOPER
1508 bool collisionDebugEnabled = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_COLLISIONDEBUG);
1509 #endif
1510 if (g_Game.IsBoxCollidingGeometry(Vector(center[0], center[1] + absoluteOfset, center[2]), m_EntityParent.GetOrientation(), edgeLength, check_data.m_PrimaryGeometry, check_data.m_SecondaryGeometry, excludedObjects, collidedObjects))
1511 {
1512 bool validCollision = false;
1513 #ifdef DIAG_DEVELOPER
1514 array<string> validEntityCollisions = new array<string>();
1515 #endif
1516
1517 for (int i = 0; i < collidedObjects.Count(); ++i)
1518 {
1519 EntityAI entity = EntityAI.Cast(collidedObjects.Get(i));
1520 if (entity && !entity.IsIgnoredByConstruction())
1521 {
1522 validCollision = true;
1523 #ifdef DIAG_DEVELOPER
1524 if (collisionDebugEnabled)
1525 {
1526 validEntityCollisions.Insert(entity.GetType());
1527 }
1528 #else
1529 break;
1530 #endif
1531 }
1532 }
1533
1534 #ifdef DIAG_DEVELOPER
1535 if (collisionDebugEnabled)
1536 {
1537 if (validCollision)
1538 {
1539 ConstructionDebug.SetCollisionPrintoutData(check_data.m_PartName, validEntityCollisions);
1540 DrawDebugCollisionBox(minMax, ARGB(150, 0, 0, 255));
1541 }
1542 else
1543 {
1544 ConstructionDebug.ResetCollisionPrintoutData();
1545 DrawDebugCollisionBox(minMax, ARGB(150, 255, 255, 255));
1546 }
1547 }
1548 else if (m_CollisionBox)
1549 {
1550 DestroyDebugCollisionBox();
1551 }
1552 #endif
1553
1554 return validCollision;
1555 }
1556 #ifdef DIAG_DEVELOPER
1557 else //Debug
1558 {
1559 if (collisionDebugEnabled)
1560 {
1561 ConstructionDebug.ResetCollisionPrintoutData();
1562 DrawDebugCollisionBox(minMax, ARGB(150, 255, 255, 255));
1563 }
1564 else if (m_CollisionBox)
1565 {
1566 DestroyDebugCollisionBox();
1567 }
1568 }
1569 #endif
1570 }
1571 return false;
1572 }
ConstructionPart GetConstructionPart()
Определения ActionPartInfo.c:235
vector GetBoxCenter(vector min_max[2])
Определения ConstructionBase.c:1634
vector GetCollisionBoxSize(vector min_max[2])
Определения ConstructionBase.c:1574
void GetCollisionBoxData(string part_name, out vector min_max[2])
Определения ConstructionBase.c:1586
EntityAI m_EntityParent
Определения ConstructionBase.c:45
DayZGame g_Game
Определения DayZGame.c:4074
DiagMenuIDs
Определения EDiagMenuIDs.c:2
static bool GetDisableIsCollidingCheck()
Определения CfgGameplayHandler.c:337
array< string > GetCollisionData()
strings of min/max selections (should be single points in memory LOD)
Определения ConstructionPart.c:294
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
Определения EnDebug.c:241
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322

Перекрестные ссылки ARGB(), CollisionCheckData(), g_Game, DiagMenu::GetBool(), GetBoxCenter(), GetCollisionBoxData(), GetCollisionBoxSize(), ConstructionPart::GetCollisionData(), GetConstructionPart(), CfgGameplayHandler::GetDisableIsCollidingCheck(), m_EntityParent и Vector().