I've tested to change the code, so that the placing object's size was called "objects( 1 ).sizeX" and so on, but it didn't work. The problem seems to be the variable itself. It seems that the code works, if I make so I always place on object with the size 10. But if I use variables, it doesn't work. This code works:
function placeObjectWithMouse()
if object exist( 2 ) = false then exitfunction
setObjectAtMouse()
if mouseclick() = true
rem Find an object number
repeat : inc exist, 1 : until object exist( exist ) = 0
rem Make so the placing object become more invisible
set alpha mapping on 2, 20
rem Array stuff
array insert at top objects()
ac = array count( objects() )
objects( ac ).objectNum = exist
objects( ac ).objectAngleX = object angle x( 2 )
objects( ac ).objectAngleY = object angle y( 2 )
objects( ac ).objectAngleZ = object angle z( 2 )
rem Place the object
make object box objects( ac ).objectNum, 10, 10, 10
position object objects( ac ).objectNum, object position x( 2 ), object position y( 2 ), object position z( 2 )
rotate object objects( ac ).objectNum, objects( ac ).objectAngleX, objects( ac ).objectAngleY , objects( ac ).objectAngleZ
sync : repeat : until mouseclick() <> 1
else
set alpha mapping on 2, 90
endif
endfunction
. The strange thing is that the code that I use to scale the object works, even if I use the variables:
function sizeObject()
if object exist( 2 ) = false or keystate( 82 ) = true or keystate( 83 ) = true then exitfunction
objects( 1 ).objectAngleX = object angle x( 2 )
objects( 1 ).objectAngleY = object angle y( 2 )
objects( 1 ).objectAngleZ = object angle z( 2 )
rem Size the object at the z-axis
if keystate( 72 ) = true
delete object 2
inc objects( 1 ).sizeZ, 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
if keystate( 80 ) = true
delete object 2
dec objects( 1 ).sizeZ, 1
if objects( 1 ).sizeZ < 1 then objects( 1 ).sizeZ = 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
rem Size the object at the x-axis
if keystate( 75 ) = true
delete object 2
inc objects( 1 ).sizeX, 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
if keystate( 77 ) = true
delete object 2
dec objects( 1 ).sizeX, 1
if objects( 1 ).sizeX < 1 then objects( 1 ).sizeX = 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
rem Size the object at the y-axis
if keystate( 78 ) = true
delete object 2
inc objects( 1 ).sizeY, 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
if keystate( 74 ) = true
delete object 2
dec objects( 1 ).sizeY, 1
if objects( 1 ).sizeY < 1 then objects( 1 ).sizeY = 1
make object box 2, objects( 1 ).sizeX, objects( 1 ).sizeY, objects( 1 ).sizeZ
rotate object 2, objects( 1 ).objectAngleX, objects( 1 ).objectAngleY , objects( 1 ).objectAngleZ
color object 2, rgb(255, 0, 0)
setObjectAtMouse()
set alpha mapping on 2, 90
endif
endfunction
. And when I use variables to rotate the objects it works. Can anyone help me?