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

◆ GetSurfaceOrientation()

vector CGame::GetSurfaceOrientation ( float x,
float z )
inlineprotected

Returns tilt of the ground on the given position in degrees, so you can use this value to rotate any item according to terrain.

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

1144 {
1145 vector normal = GetGame().SurfaceGetNormal(x, z);
1146 vector angles = normal.VectorToAngles();
1147 angles[1] = angles[1]+270; // This fixes rotation of item so it stands vertically. Feel free to change, but fix existing use cases.
1148
1149 //Hack because setorientation and similar functions break and flip stuff upside down when using exactly this vector ¯\_(ツ)_/¯ (note: happens when surface is flat)
1150 if (angles == "0 540 0")
1151 angles = "0 0 0";
1152 return angles;
1153 }
Icon x
proto native vector SurfaceGetNormal(float x, float z)
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native CGame GetGame()

Перекрестные ссылки GetGame(), SurfaceGetNormal(), vector::VectorToAngles() и x.

Используется в Hit_MeatBones::BloodSplatGround() и PluginBase::SetupSpawnedEntity().