1267 {
1268 vector m4[4];
1269 owner.GetTransform(m4);
1270
1271 vector randomPos =
Vector(Math.RandomFloat(-halfExtents[0], halfExtents[0]), 0, Math.RandomFloat(-halfExtents[2], halfExtents[2]));
1272 randomPos = vector.
RotateAroundZero(randomPos, vector.Up, cosAngle, sinAngle);
1273
1274 float dist = randomPos[0] * m4[1][0] + randomPos[1] * m4[1][1] + randomPos[2] * m4[1][2];
1275
1276 m4[3][0] = m4[3][0] + randomPos[0];
1277 m4[3][1] = m4[3][1] - dist + halfExtents[1];
1278 m4[3][2] = m4[3][2] + randomPos[2];
1279
1280 item.PlaceOnSurfaceRotated(m4,
Vector(m4[3][0], m4[3][1], m4[3][2]));
1281
1282 ground.SetGround(item, m4);
1283 }
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.