1308 {
1309 vector m4[4];
1310 owner.GetTransform(m4);
1311
1312 vector randomPos =
Vector(Math.RandomFloat(-halfExtents[0], halfExtents[0]), 0, Math.RandomFloat(-halfExtents[2], halfExtents[2]));
1313 randomPos = vector.
RotateAroundZero(randomPos, vector.Up, cosAngle, sinAngle);
1314
1315 float dist = randomPos[0] * m4[1][0] + randomPos[1] * m4[1][1] + randomPos[2] * m4[1][2];
1316
1317 m4[3][0] = m4[3][0] + randomPos[0];
1318 m4[3][1] = m4[3][1] - dist + halfExtents[1];
1319 m4[3][2] = m4[3][2] + randomPos[2];
1320
1321 item.PlaceOnSurfaceRotated(m4,
Vector(m4[3][0], m4[3][1], m4[3][2]));
1322
1323 ground.SetGround(item, m4);
1324 }
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.