ok, i got it sorted using the SET CAMERA TO FOLLOW command. however, i also had to rewrite some parts of the code, because i had the oriantation completly wrong.
Please Explain !
is it true, that if i want a plain to "lay on the floor" in correct oriantation, i need to XROTATE it 180, YROTATE it 90 and ZROTATE it 90 degrees after creating it ?
for reference, new code below:
REM - Screen Setup
Sync On
Sync Rate 60
backdrop off
REM - Types
TYPE DropableBox
BoxColor AS DWORD
IsFalling AS INTEGER
PosX#
PosY#
PosZ#
ENDTYPE
REM - Constants
BoxesSize# = 5
BoxesFallSpeed# = 1
BoxesFallHeight#= 200
PaneWidth# = 15
PaneLength# = 15
CamAngleX# = 310
CamAngleY# = 0
CamAngleZ# = 15
CamStartPosX# = 25
CamStartPosY# = -110
CamStartPosZ# = -130
CamAutoRotate = 1
CamRadius# = 100.0
CamAng# = 0
CamMoveInterval# = .075
Randomize Timer()
DIM SceneBoxes() AS DropableBox
EMPTY ARRAY SceneBoxes()
MAKE OBJECT PLAIN 1, BoxesSize# * PaneWidth#, BoxesSize# * PaneLength#
XROTATE OBJECT 1, 180
YROTATE OBJECT 1, 90
ZROTATE OBJECT 1, 90
REM MAKE OBJECT CUBE 2, BoxesSize#
REM POSITION OBJECT 2, OBJECT POSITION X(1), OBJECT POSITION Y(1), OBJECT POSITION Z(1)-BoxesSize#
REM COLOR OBJECT 2, rgb(255,0,0)
MAKE CAMERA 1
MAKE LIGHT 1
SET POINT LIGHT 1, OBJECT POSITION X(1), OBJECT POSITION Y(1)-100, OBJECT POSITION Z(1)
SHOW LIGHT 1
POSITION CAMERA 1, CamStartPosX#, CamStartPosY#, CamStartPosZ#
REM - Making the Border ----------------------------------------------------------------------------
REMSTART
for i = 0 TO PaneWidth#-1 STEP 1
MAKECUBE( OBJECT POSITION X(1)-(OBJECT SIZE X(1)/2)+(BoxesSize#/2)+i*BoxesSize#, OBJECT POSITION Y(1)-(OBJECT SIZE Y(1)/2)+(BoxesSize#/2),OBJECT POSITION Z(1)-(BoxesSize#/2)-0.01)
next i
for i = 1 TO PaneWidth#-1 STEP 1
MAKECUBE( OBJECT POSITION X(1)-(OBJECT SIZE X(1)/2)+(BoxesSize#/2), OBJECT POSITION Y(1)-(OBJECT SIZE Y(1)/2)+(BoxesSize#/2)+i*BoxesSize#,OBJECT POSITION Z(1)-(BoxesSize#/2)-0.01)
next i
for i = 0 to PaneLength#-2 STEP 1
MAKECUBE( OBJECT POSITION X(1)+(OBJECT SIZE X(1)/2)-(BoxesSize#/2)-i*BoxesSize#, OBJECT POSITION Y(1)+(OBJECT SIZE Y(1)/2)-(BoxesSize#/2),OBJECT POSITION Z(1)-(BoxesSize#/2)-0.01)
next i
for i = 1 to PaneLength#-2 STEP 1
MAKECUBE( OBJECT POSITION X(1)+(OBJECT SIZE X(1)/2)-(BoxesSize#/2), OBJECT POSITION Y(1)+(OBJECT SIZE Y(1)/2)-(BoxesSize#/2)-i*BoxesSize#,OBJECT POSITION Z(1)-(BoxesSize#/2)-0.01)
next i
REMEND
for i = 0 TO PaneLength#-1 STEP 1
MAKECUBE( OBJECT POSITION X(1)-OBJECT SIZE Y(1)/2+(BoxesSize#/2)+i*BoxesSize#,OBJECT POSITION Y(1)+(BoxesSize#/2)+0.00,OBJECT POSITION Z(1)+OBJECT SIZE X(1)/2-(BoxesSize#/2))
next i
for i = 1 TO PaneWidth#-1 STEP 1
MAKECUBE( OBJECT POSITION X(1)-OBJECT SIZE Y(1)/2+(BoxesSize#/2),OBJECT POSITION Y(1)+(BoxesSize#/2)+0.00,OBJECT POSITION Z(1)+OBJECT SIZE X(1)/2-(BoxesSize#/2)-i*BoxesSize#)
next i
for i = 0 TO PaneLength#-2 STEP 1
MAKECUBE( OBJECT POSITION X(1)+OBJECT SIZE Y(1)/2-(BoxesSize#/2)-i*BoxesSize#,OBJECT POSITION Y(1)+(BoxesSize#/2)+0.00,OBJECT POSITION Z(1)-OBJECT SIZE X(1)/2+(BoxesSize#/2))
next i
for i = 1 TO PaneWidth#-2 STEP 1
MAKECUBE( OBJECT POSITION X(1)+OBJECT SIZE Y(1)/2-(BoxesSize#/2),OBJECT POSITION Y(1)+(BoxesSize#/2)+0.00,OBJECT POSITION Z(1)-OBJECT SIZE X(1)/2+(BoxesSize#/2)+i*BoxesSize#)
next i
for i = 0 TO ARRAY COUNT(SceneBoxes()) STEP 1
MAKE OBJECT CUBE 2+i, BoxesSize#
POSITION OBJECT 2+i, SceneBoxes(i).PosX#, SceneBoxes(i).PosY#, SceneBoxes(i).PosZ#
COLOR OBJECT 2+i,SceneBoxes(i).BoxColor
next i
REM ------------------------------------------------------------------------------------------------
REPEAT
REM - Randomly Create New Falling Box
if rnd(10)= 0
MAKECUBE_F( OBJECT POSITION X(1)-(OBJECT SIZE Y(1)/2)+(BoxesSize#/2)+((rnd(PaneLength#-3)+1)*BoxesSize#),OBJECT POSITION Y(1)+BoxesFallHeight#,OBJECT POSITION Z(1)-(OBJECT SIZE X(1)/2)+(BoxesSize#/2)+((rnd(PaneWidth#-3)+1)*BoxesSize#))
MAKE OBJECT CUBE 2+ARRAY COUNT(SceneBoxes()),BoxesSize#
POSITION OBJECT 2+ARRAY COUNT(SceneBoxes()),SceneBoxes(ARRAY COUNT(SceneBoxes())).PosX#,SceneBoxes(ARRAY COUNT(SceneBoxes())).PosY#,SceneBoxes(ARRAY COUNT(SceneBoxes())).PosZ#
COLOR OBJECT 2+ARRAY COUNT(SceneBoxes()),SceneBoxes(ARRAY COUNT(SceneBoxes())).BoxColor
SET OBJECT COLLISION TO BOXES 2+ ARRAY COUNT(SceneBoxes())
SET OBJECT CULL 2+ARRAY COUNT(SceneBoxes()),1
endif
REM ------------------------------------------------------------------------------------------------
REM MAKECUBE_F( OBJECT POSITION X(1)-(OBJECT SIZE X(1)/2)+(BoxesSize#/2)+(0+1)*BoxesSize#,OBJECT POSITION Y(1)-(OBJECT SIZE Y(1)/2)+(BoxesSize#/2)+(0+1)*BoxesSize#,OBJECT POSITION Z(1)-BoxesFallHeight#)
REM MAKE OBJECT CUBE 2+ARRAY COUNT(SceneBoxes()),BoxesSize#
REM POSITION OBJECT 2+ARRAY COUNT(SceneBoxes()),SceneBoxes(ARRAY COUNT(SceneBoxes())).PosX#,SceneBoxes(ARRAY COUNT(SceneBoxes())).PosY#,SceneBoxes(ARRAY COUNT(SceneBoxes())).PosZ#
REM COLOR OBJECT 2+ARRAY COUNT(SceneBoxes()),SceneBoxes(ARRAY COUNT(SceneBoxes())).BoxColor
REM - Move Boxes Down ------------------------------------------------------------------------------
for i=0 TO ARRAY COUNT(SceneBoxes()) STEP 1
if SceneBoxes(i).IsFalling = 1
SceneBoxes(i).PosY#= SceneBoxes(i).PosY# - BoxesFallSpeed#
POSITION OBJECT 2+i, SceneBoxes(i).PosX#,SceneBoxes(i).PosY#,SceneBoxes(i).PosZ#
REM if OBJECT COLLISION(1,2+i) > 0
REM SceneBoxes(i).IsFalling = 0
REM endif
if SceneBoxes(i).PosY# <= OBJECT POSITION Y(1)+(BoxesSize#-1) then SceneBoxes(i).IsFalling = 0
for j=0 TO ARRAY COUNT(SceneBoxes()) STEP 1
if SceneBoxes(j).IsFalling = 0
if OBJECT POSITION X(2+j) = OBJECT POSITION X(2+i) AND OBJECT POsITION Z(2+j) = OBJECT POSITION Z(2+i)
if OBJECT COLLISION(2+j,2+i) > 0
SceneBoxes(i).IsFalling = 0
endif
endif
endif
next j
endif
next i
REM ------------------------------------------------------------------------------------------------
if UpKey() = 1
CamAngleX# = CamAngleX# + CamMoveInterval#
if CamAngleX# > 360 then CamAngleX# = 0
endif
if DownKey() = 1
CamAngleX# = CamAngleX# - CamMoveInterval#
if CamAngleX# < 0 then CamAngleX# = 360
endif
if Leftkey() = 1
CamAngleY# = CamAngleY# + CamMoveInterval#
if CamAngleY# > 360 then CamAngleY# = 0
endif
if RightKey() = 1
CamAngleY# = CamAngleY# - CamMoveInterval#
if CamAngleY# < 0 then CamAngleY# = 360
endif
if ScanCode() = 79
CamAngleZ# = CamAngleZ# + CamMoveInterval#
if CamAngleZ# > 360 then CamAngleZ# = 0
endif
if ScanCode() = 82
CamAngleZ# = CamAngleZ# - CamMoveInterval#
if CamAngleZ# < 0 then CamAngleZ# = 360
endif
if ScanCode() = 17
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1)-CamMoveInterval#, CAMERA POSITION Z(1)
endif
if ScanCode() = 31
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1)+CamMoveInterval#, CAMERA POSITION Z(1)
endif
if ScanCode() = 32
POSITION CAMERA 1, CAMERA POSITION X(1)-CamMoveInterval#, CAMERA POSITION Y(1), CAMERA POSITION Z(1)
endif
if ScanCode() = 30
POSITION CAMERA 1, CAMERA POSITION X(1)+CamMoveInterval#, CAMERA POSITION Y(1), CAMERA POSITION Z(1)
endif
if ScanCode() = 33
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1), CAMERA POSITION Z(1)-CamMoveInterval#
endif
if ScanCode() = 19
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1), CAMERA POSITION Z(1)+CamMoveInterval#
endif
if ScanCode() = 83
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1)-CamMoveInterval#, CAMERA POSITION Z(1)
endif
if ScanCode() = 81
POSITION CAMERA 1, CAMERA POSITION X(1), CAMERA POSITION Y(1)+CamMoveInterval#, CAMERA POSITION Z(1)
endif
Print "CAM POS: X:",CAMERA POSITION X(1)," Y: ",CAMERA POSITION Y(1)," Z: ",CAMERA POSITION Z(1)
Print "CAM ANGLE: X:",CamAngleX#," Y: ",CamAngleY#," Z: ",CamAngleZ#
Print "CAM PITCH: ",CamPitchAngle#
XROTATE CAMERA 1,CamAngleX#
YROTATE CAMERA 1,CamAngleY#
ZROTATE CAMERA 1,CamAngleZ#
if CamAutoRotate = 1
inc CamAng#,0.5
if CamAng# > 360 then CamAng# = 0
SET CAMERA TO FOLLOW 1 ,OBJECT POSITION X(1),OBJECT POSITION Y(1), OBJECT POSITION Z(1),CamAng#,100,100,10,0
POINT CAMERA 1, OBJECT POSITION X(1),OBJECT POSITION Y(1), OBJECT POSITION Z(1)
endif
Sync
UNTIL SpaceKey()=1
end
function MAKECUBE_F(X#, Y#, Z#):
ARRAY INSERT AT BOTTOM SceneBoxes()
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosX# = X#
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosY# = Y#
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosZ# = Z#
SceneBoxes(ARRAY COUNT(SceneBoxes())).BoxColor = RGB(rnd(255),rnd(255),rnd(255))
SceneBoxes(ARRAY COUNT(SceneBoxes())).IsFalling = 1
endfunction
function MAKECUBE(X#, Y#, Z#):
ARRAY INSERT AT BOTTOM SceneBoxes()
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosX# = X#
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosY# = Y#
SceneBoxes(ARRAY COUNT(SceneBoxes())).PosZ# = Z#
SceneBoxes(ARRAY COUNT(SceneBoxes())).BoxColor = RGB(255,0,0)
endfunction