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

◆ GetProjectionEntityPosition()

vector Hologram::GetProjectionEntityPosition ( PlayerBase player)
inlineprotected

will not push hologram up when there is direct hit of an item

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

1088 {
1089 float minProjectionDistance;
1090 float maxProjectionDistance;
1091 m_ContactDir = vector.Zero;
1092 vector minMax[2];
1093 float projectionRadius = GetProjectionRadius();
1094 float cameraToPlayerDistance = vector.Distance(GetGame().GetCurrentCameraPosition(), player.GetPosition());
1095
1096 if (projectionRadius < SMALL_PROJECTION_RADIUS) // objects with radius smaller than 1m
1097 {
1098 minProjectionDistance = SMALL_PROJECTION_RADIUS;
1099 maxProjectionDistance = SMALL_PROJECTION_RADIUS * 2;
1100 }
1101 else
1102 {
1103 minProjectionDistance = projectionRadius;
1104 maxProjectionDistance = projectionRadius * 2;
1105 maxProjectionDistance = Math.Clamp(maxProjectionDistance, SMALL_PROJECTION_RADIUS, LARGE_PROJECTION_DISTANCE_LIMIT);
1106 }
1107
1108 vector from = GetGame().GetCurrentCameraPosition();
1109 vector to = from + (GetGame().GetCurrentCameraDirection() * (maxProjectionDistance + cameraToPlayerDistance));
1110 vector contactPosition;
1111 set<Object> hitObjects = new set<Object>();
1112
1113 DayZPhysics.RaycastRV(from, to, contactPosition, m_ContactDir, m_ContactComponent, hitObjects, player, m_Projection, false, false, ObjIntersectFire);
1114
1115 bool contactHitProcessed = false;
1117 if (!CfgGameplayHandler.GetDisableIsCollidingBBoxCheck())
1118 {
1119 if (hitObjects.Count() > 0)
1120 {
1121 if (hitObjects[0].IsInherited(Watchtower))
1122 {
1123 contactHitProcessed = true;
1124 contactPosition = CorrectForWatchtower(m_ContactComponent, contactPosition, player, hitObjects[0]);
1125 }
1126
1127 if (!contactHitProcessed && hitObjects[0].IsInherited(InventoryItem))
1128 contactPosition = hitObjects[0].GetPosition();
1129 }
1130 }
1131
1132 static const float raycastOriginOffsetOnFail = 0.25;
1133 static const float minDistFromStart = 0.01;
1134 // Camera isn't correctly positioned in some cases, leading to raycasts hitting the object directly behind the camera
1135 if ((hitObjects.Count() > 0) && (vector.DistanceSq(from, contactPosition) < minDistFromStart))
1136 {
1137 from = contactPosition + GetGame().GetCurrentCameraDirection() * raycastOriginOffsetOnFail;
1138 DayZPhysics.RaycastRV(from, to, contactPosition, m_ContactDir, m_ContactComponent, hitObjects, player, m_Projection, false, false, ObjIntersectFire);
1139 }
1140
1141 bool isFloating = SetHologramPosition(player.GetPosition(), minProjectionDistance, maxProjectionDistance, contactPosition);
1142 SetIsFloating(isFloating);
1143
1144 #ifdef DIAG_DEVELOPER
1145 DrawDebugArrow(minProjectionDistance, maxProjectionDistance);
1146 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
1147 {
1148 Debug.DrawSphere(GetProjectionPosition(), 0.1, 0x99FF0000, ShapeFlags.ONCE|ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE);
1149 }
1150 #endif
1151
1152 m_FromAdjusted = from;
1153
1154 return contactPosition;
1155 }
DiagMenuIDs
Определения EDiagMenuIDs.c:2
void Debug()
Определения UniversalTemperatureSource.c:349
proto native vector GetCurrentCameraPosition()
proto native vector GetCurrentCameraDirection()
const float LARGE_PROJECTION_DISTANCE_LIMIT
Deprecated.
Определения Hologram.c:48
vector m_ContactDir
Определения Hologram.c:38
EntityAI m_Projection
Определения Hologram.c:22
const float SMALL_PROJECTION_RADIUS
Определения Hologram.c:45
int m_ContactComponent
Определения Hologram.c:57
vector m_FromAdjusted
Определения Hologram.c:39
bool SetHologramPosition(vector startPosition, float minProjectionDistance, float maxProjectionDistance, inout vector contactPosition)
Sets hologram position based on player and projection distance.
Определения Hologram.c:1165
void SetIsFloating(bool is_floating)
Определения Hologram.c:1288
vector CorrectForWatchtower(int contactComponent, vector contactPos, PlayerBase player, Object hitObject)
Определения Hologram.c:1219
float GetProjectionRadius()
Определения Hologram.c:1248
vector GetProjectionPosition()
Определения Hologram.c:1445
proto native CGame GetGame()
ShapeFlags
Определения EnDebug.c:126

Перекрестные ссылки Math::Clamp(), CorrectForWatchtower(), vector::Distance(), vector::DistanceSq(), Debug::DrawSphere(), DiagMenu::GetBool(), CGame::GetCurrentCameraDirection(), CGame::GetCurrentCameraPosition(), CfgGameplayHandler::GetDisableIsCollidingBBoxCheck(), GetGame(), GetProjectionPosition(), GetProjectionRadius(), LARGE_PROJECTION_DISTANCE_LIMIT, m_ContactComponent, m_ContactDir, m_FromAdjusted, m_Projection, DayZPhysics::RaycastRV(), SetHologramPosition(), SetIsFloating(), SMALL_PROJECTION_RADIUS и vector::Zero.

Используется в UpdateHologram().