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

◆ AlignProjectionOnTerrain()

vector Hologram::AlignProjectionOnTerrain ( float timeslice)
inlineprotected

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

294 {
295 vector y_p_r;
296
297 if ( m_AlignToTerrain )
298 {
299 vector projection_orientation_angles = GetDefaultOrientation() + GetProjectionRotation();
300 vector mat0[3];
301 vector mat1[3];
302 vector mat2[3];
303 vector projection_position = m_Projection.GetPosition();
304 vector normal;
305
306 if ( m_ContactDir.Length() > 0 )
307 {
308 normal = m_ContactDir;
309 }
310 else
311 {
312 normal = GetGame().SurfaceGetNormal( projection_position[0], projection_position[2] );
313 }
314
315 vector angles = normal.VectorToAngles();
316 angles[1] = angles[1] + 270;
317
318 angles[0] = Math.Clamp( angles[0], 0, 360 );
319 angles[1] = Math.Clamp( angles[1], 0, 360 );
320 angles[2] = Math.Clamp( angles[2], 0, 360 );
321
322 projection_orientation_angles[0] = projection_orientation_angles[0] + ( 360 - angles[0] );
323
324 Math3D.YawPitchRollMatrix( projection_orientation_angles, mat0 );
325 Math3D.YawPitchRollMatrix( angles, mat1 );
326 Math3D.MatrixMultiply3( mat1, mat0, mat2 );
327
328 y_p_r = Math3D.MatrixToAngles( mat2 );
329 }
330 else
331 {
333
334 if ( y_p_r[0] > 180 )
335 {
336 y_p_r[0] = y_p_r[0] - 360;
337 }
338
339 if ( y_p_r[0] < -180 )
340 {
341 y_p_r[0] = y_p_r[0] + 360;
342 }
343 }
344
345 return SmoothProjectionMovement( y_p_r, timeslice );
346 }
proto native vector SurfaceGetNormal(float x, float z)
vector m_ContactDir
Определения Hologram.c:38
EntityAI m_Projection
Определения Hologram.c:22
vector SmoothProjectionMovement(vector y_p_r, float timeslice)
Определения Hologram.c:348
bool m_AlignToTerrain
Определения Hologram.c:55
vector GetProjectionRotation()
Определения Hologram.c:1362
vector GetDefaultOrientation()
Определения Hologram.c:1461
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native CGame GetGame()

Перекрестные ссылки Math::Clamp(), GetDefaultOrientation(), GetGame(), GetProjectionRotation(), m_AlignToTerrain, m_ContactDir, m_Projection, Math3D::MatrixMultiply3(), Math3D::MatrixToAngles(), SmoothProjectionMovement(), CGame::SurfaceGetNormal(), vector::VectorToAngles() и Math3D::YawPitchRollMatrix().

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