Rotating trees
This commit is contained in:
parent
7ed2f43346
commit
3bcb8efaff
@ -122,22 +122,13 @@ public class Main : MonoBehaviour
|
|||||||
{
|
{
|
||||||
for (int k = 0; k < rowsNumber * gridShiftZ; k += gridShiftZ)
|
for (int k = 0; k < rowsNumber * gridShiftZ; k += gridShiftZ)
|
||||||
{
|
{
|
||||||
// vector for rotating 90 deg
|
|
||||||
Vector3 rotationVectorRotateX = new Vector3(-90, Random.Range(0.0f, 360.0f), 0);
|
|
||||||
Vector3 rotationVector = new Vector3(0, Random.Range(0.0f, 360.0f), 0);
|
Vector3 rotationVector = new Vector3(0, Random.Range(0.0f, 360.0f), 0);
|
||||||
randomShiftX = random.Next(0, maxShiftValue);
|
randomShiftX = random.Next(0, maxShiftValue);
|
||||||
randomShiftZ = random.Next(0, maxShiftValue);
|
randomShiftZ = random.Next(0, maxShiftValue);
|
||||||
GameObject tree = SelectRandomTree();
|
GameObject tree = SelectRandomTree();
|
||||||
|
|
||||||
// trees other than AS12_4 have to be rotated 90 deg
|
renderedTrees.Add(Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVector)));
|
||||||
if (tree.name != "AS12_4")
|
|
||||||
{
|
|
||||||
renderedTrees.Add(Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVector)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
renderedTrees.Add(Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVectorRotateX)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user