Hello, friends. So, i start experiment with objects positioning on scenes from code.
Because static point of player view is on X = 0 and Y = 0, i decided set objects on circumferences around camera with few meters step.
For position calculation i try to use school formulas for searching point on circle by sin and cos.
But it work wrong, because all test objects puts on one quadrant (really, i know, program can’t work wrong, but may be written wrong).
I show code and screenshots. I think, it fail, because all sin and cos in my program have positive value… Maybe, i need help with Pascal math?
In next code SectorsCount := 80, so, i want to change 80 sectors of circle and add in every sector 20 Experimental Tree.
constructor TEnvironment.CreateEnvironment(var Viewport: TCastleViewport);
begin
SetLength(GridOfEssences, SectorsCount, 20);
for i := 0 to SectorsCount - 1 do
for j := 0 to 19 do
begin
GridOfEssences[i][j] := TCastleImageTransform.Create(FreeAtStop);
Viewport.Items.Add(GridOfEssences[i][j]);
GridOfEssences[i][j].Size := Vector2(2, 2);
GridOfEssences[i][j].Translation := Vector3(5 * i * cos (360 / 80) * i, 1, 5 * j * sin (360 / 80) * i);
GridOfEssences[i][j].Url := 'castle-data://Objects/Tree_01.png';
end;
end;
P.S I little shy to share all my code, because know this is hard labour to understand somebody code. But i can show it, if it helps…