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

◆ OnContact()

override void Car::OnContact ( string zoneName,
vector localPos,
IEntity other,
Contact data )
inlineprotected

WARNING: Can be called very frequently in one frame, use with caution.

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

1455 {
1456 if (g_Game.IsServer())
1457 {
1458 #ifdef DIAG_DEVELOPER
1459 m_ContactCalled = true;
1460 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.CONTACT)
1461 {
1462 string output = "Zone: " + zoneName + " | Impulse:" + data.Impulse;
1463 Debug.Log(output);
1464 }
1465 #endif
1466 if (m_ContactCache.Count() == 0)
1467 {
1468 array<ref CarContactData> ccd = new array<ref CarContactData>;
1469 m_ContactCache.Insert(zoneName, ccd);
1470 float momentumDelta = GetMomentum() - m_MomentumPrevTick;
1471 float dot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1472 if (dot < 0)
1473 {
1474 momentumDelta = m_MomentumPrevTick;
1475 }
1476
1477 ccd.Insert(new CarContactData(localPos, other, momentumDelta));
1478 }
1479 }
1480 }
string Debug()
Определения CachedEquipmentStorageBase.c:29
DayZGame g_Game
Определения DayZGame.c:3942
vector m_VelocityPrevTick
Определения CarScript.c:180
float m_MomentumPrevTick
Определения CarScript.c:179
ref CarContactCache m_ContactCache
Определения CarScript.c:181
float Impulse
Impulse applied to resolve the collision.
Определения Contact.c:21
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.

Перекрестные ссылки vector::Dot(), g_Game, GetVelocity(), Contact::Impulse, Debug::Log(), m_ContactCache, m_MomentumPrevTick и m_VelocityPrevTick.