Okay now I need some real help. Here's the full bit of code. My pick commands and the raising of the terrain is confusing me now since the code is getting pretty heavy. I'm trying to incorporate the values in the arrays to the corresponding areas but I don't know what I am doing wrong, nor do I know what I am doing right. You need Ian's Matrix Utility plugin to run this, but please - if anyone can give an example or some example code just so I have something to go on. Here is the titan of confusion:
SET DISPLAY MODE DESKTOP WIDTH(), DESKTOP HEIGHT(), 32, 1
`MAKE CAMERA 1
`SET CURRENT CAMERA 1
`object:
Scale=10
ObjSize=250
Seg=50
`vertex editing (averaging)
HeightA=5
HeightB=4
HeightC=3
HeightD=2
HeightE=1
For ObX=1 to ObjSize*Scale step ObjSize
For ObY=1 to ObjSize*Scale step ObjSize
inc ObjectNumber, 1
MAKE OBJECT PLAIN ObjectNumber, ObjSize, ObjSize, Seg, Seg, 338
POSITION OBJECT ObjectNumber, (ObjSize*(Scale/2))-(ObX-1)-(ObjSize/2), 0, (ObjSize*(Scale/2))-(ObY-1)-(ObjSize/2)
ROTATE OBJECT ObjectNUmber, 0, 90, 0
COLOR OBJECT ObjectNumber, RGB(0, 128, 255)
SET OBJECT WIREFRAME ObjectNumber, 0
MAKE MESH FROM OBJECT ObjectNumber, ObjectNumber
next ObY
next ObX
LOCK VERTEXDATA FOR LIMB 1, 0
ArrayCount=GET VERTEXDATA VERTEX COUNT()
Dim PickX(ArrayCount)
Dim PickZ(ArrayCount)
Dim PickXB(ArrayCount)
Dim PickZB(ArrayCount)
UNLOCK VERTEXDATA
COLOR BACKDROP 0, RGB(0,0,0)
set camera range 0,0.01, 125000.0
`Make a 3d cursor
righttop=FIND FREE OBJECT()
MouseRTop=righttop
MAKE OBJECT plain MouseRTop, 5,5
lefttop=FIND FREE OBJECT()
MouseLTop=lefttop
MAKE OBJECT plain MouseLTop, 5,5
RightBottom=FIND FREE OBJECT()
MouseRBottom=RightBottom
MAKE OBJECT plain MouseRBottom, 5,5
LeftBottom=FIND FREE OBJECT()
MouseLBottom=LeftBottom
MAKE OBJECT plain MouseLBottom, 5,5
CenterTop=FIND FREE OBJECT()
MouseCT=CenterTop
MAKE OBJECT plain MouseCT, 5,5
CenterBottom=FIND FREE OBJECT()
MouseCB=CenterBottom
MAKE OBJECT plain MouseCB, 5,5
Center=FIND FREE OBJECT()
MouseC=Center
MAKE OBJECT plain MouseC, 4,4
HIDE OBJECT MouseLTop
HIDE OBJECT MouseRTop
HIDE OBJECT MouseLBottom
HIDE OBJECT MouseRBottom
HIDE OBJECT MouseCT
HIDE OBJECT MouseCB
HIDE OBJECT MouseC
SET TEXT FONT "Arial"
SET TEXT SIZE 16
autocam off
` (ObjSize*scale)
`(ObjSize*scale)/2
`position camera 0,0, (ObjSize*scale)/7.5, 0
Cdist#=(ObjSize*scale)/10
World=3
vector=1
length=2
Wol= Make Matrix4(World)
Wld=MAKE VECTOR3(vector)
lgth=MAKE VECTOR3(length)
do
WORLD MATRIX4 World
ObjectNumber2=PICK OBJECT(MouseX(), MouseY(),1,ObjectNumber)
PickD#=GET PICK DISTANCE()
PickX#=GET PICK VECTOR X()+CAMERA POSITION X(0)
PickY#=GET PICK VECTOR Y()+CAMERA POSITION Y(0)
PickZ#=GET PICK VECTOR Z()+CAMERA POSITION Z(0)
PickX#=int(PickX#)/(Seg/scale)*(Seg/scale)
PickY#=int(PickY#)/(Seg/scale)*(Seg/scale)
PickZ#=int(PickZ#)/(Seg/scale)*(Seg/scale)
`set the cursor's lines
POSITION OBJECT MouseRTop, PickX#-5, PickY#, PickZ#
MRX=int(OBJECT SCREEN X(MouseRTop))
MRY= int(OBJECT SCREEN Y(MouseRTop))
POSITION OBJECT MouseLTop, PickX#+5, PickY#, PickZ#
MLX=int(OBJECT SCREEN X(MouseLTop))
MLY=int(OBJECT SCREEN Y(MouseLTop))
POSITION OBJECT MouseRBottom, PickX#, PickY#, PickZ#-5
MRBX=int(OBJECT SCREEN X(MouseRBottom))
MRBY= int(OBJECT SCREEN Y(MouseRBottom))
POSITION OBJECT MouseLBottom, PickX#, PickY#, PickZ#+5
MLBX=int(OBJECT SCREEN X(MouseLBottom))
MLBY=int(OBJECT SCREEN Y(MouseLBottom))
POSITION OBJECT MouseCB, PickX#, PickY#-10, PickZ#
MCBX=int(OBJECT SCREEN X(MouseCB))
MCBY=int(OBJECT SCREEN Y(MouseCB))
POSITION OBJECT MouseCT, PickX#, PickY#+10, PickZ#
MCTX=int(OBJECT SCREEN X(MouseCT))
MCTY=int(OBJECT SCREEN Y(MouseCT))
POSITION OBJECT MouseC, PickX#, PickY#, PickZ#
MCX=int(OBJECT SCREEN X(MouseC))
MCY=int(OBJECT SCREEN Y(MouseC))
ORight=ObjectNumber2+1
OLeft=ObjectNumber2-1
OTop=ObjectNumber2-(Scale)
OBottom=ObjectNumber2+(Scale)
RightSideTopO=Oright-(Scale)
RightSideBottomO=ORight-(Scale+2)
LeftSideTopO=OBottom+(1)
LeftSideBottomO=OBottom-(1)
`lets make sure we return the correct values for object numbers
for Check=1 to scale
If ObjectNumber2=(Check*scale)
Oright=0
endif
If ObjectNumber2=0
Oright=0
endif
If ObjectNumber2=(Check*scale)+1
OLeft=0
endif
If ObjectNumber2=0
Oleft=0
endif
If ObjectNumber2=(Check*scale)
RightSideTopO=0
endif
If ObjectNumber2=0
RightSideTopO=0
endif
If RightSideBottomO=(Check*(scale-1))+Check
RightSideBottomO=0
endif
If ObjectNumber2=0
RightSideBottomO=0
endif
If LeftSideBottomO=(Check*(scale-1))+Check
LeftSideBottomO=0
endif
If ObjectNumber2=0
LeftSideBottomO=0
endif
If ObjectNumber2=(Check*scale)
LeftSideTopO=0
endif
If ObjectNumber2=0
LeftSideTopO=0
endif
If ObjectNumber2=(Check*scale)
OBottom=ObjectNumber2+Scale
endif
If ObjectNumber2=0
OBottom=0
endif
`Lets make sure nothing can be returned higher than the max size of the objects in question
if ORight>100 then ORight=0
if OLeft>100 then OLeft=0
if OTop>100 then OTop=0
if OBottom>100 then OBottom=0
if RightSideTopO>100 then RightSideTopO=0
if RightSideBottomO>100 then RightSideBottomO=0
if LeftSideTopO>100 then LeftSideTopO=0
if LeftSideBottomO>100 then LeftSideBottomO=0
next check
`Let's also color the objects in question just for debug purposes
For ColorScale=1 to ObjectNumber
`the gray
If ColorScale <> ObjectNumber2 or ColorScale <> ORight
COLOR OBJECT ColorScale, RGB(128, 128, 128)
endif
`white pick object
If ObjectNumber2 = ColorScale
COLOR OBJECT ObjectNumber2, RGB(255, 255, 255)
endif
`orange
If Oright = ColorScale
COLOR OBJECT Oright, RGB(255, 128, 0)
endif
`yellow
If RightSideTopO = ColorScale
COLOR OBJECT RightSideTopO, RGB(255,255, 0)
endif
`turquiose
If OLeft = ColorScale
COLOR OBJECT Oleft, RGB(0, 128, 255)
endif
`sea green
If RightSideBottomO = ColorScale
COLOR OBJECT RightSideBottomO, RGB(0,255, 128)
endif
`green
If OTop = ColorScale
COLOR OBJECT OTop, RGB(0,255, 0)
endif
`magenta
If OBottom = ColorScale
COLOR OBJECT OBottom, RGB(255,0,128)
endif
`purple
if LeftSideBottomO = ColorScale
COLOR OBJECT LeftSideBottomO, RGB(128,0,255)
endif
`red
if LeftSideTopO = ColorScale
COLOR OBJECT LeftSideTopO, RGB(255,0,0)
endif
Next ColorScale
`Just in case there are negative values for object numbers based on the main pick object (the white one ;) )
If ObjectNumber2=<0
ORight=0
OLeft=0
OTop=0
OBottom=0
RightSideTopO=0
RightSideBottomO=0
LeftSideTopO=0
LeftSideBottomO=0
endif
SET TEXT TO BOLD
ink RGB(128,128,128),RGB(0,0,0)
Text MouseX()+10, MouseY()+25, "Pick X: "+Str$(PickX#)+", Pick Y: "+Str$(PickY#)+", Pick Z: "+Str$(PickZ#)
Text 10, 130, "Selected Object: "+Str$(ObjectNumber2)
SET TEXT TO NORMAL
Text 10, 10, "Top Right Corner Object: "+Str$(RightSideTopO)
Text 10, 25, "Top Object: "+Str$(OTop)
Text 10, 40, "Top Left Corner Object: "+Str$(LeftSideTopO)
Text 10, 55, "Right Object: "+Str$(ORight)
Text 10, 70, "Left Object: "+Str$(OLeft)
Text 10, 85,"Lower Right Corner Object: "+Str$(RightSideBottomO)
Text 10, 100, "Bottom Object: "+Str$(OBottom)
Text 10, 115, "Lower Left Corner Object: "+Str$(LeftSideBottomO)
FILL CIRCLE MCX, MCY, 10, RGB(128,255,20,0)
Line MRX, MRY, MLX, MLY
Line MRBX, MRBY, MLBX, MLBY
Line MCBX, MCBY, MCTX, MCTY
CamX#=NewXValue(OBJECT POSITION X((scale*scale)), CAng#, CDist#)
CamZ#=NewZValue(OBJECT POSITION Z((scale*scale)), CAng#, CDist#)
inc CAng#, 0.0
CAng#=Wrapvalue(CAng#)
Position camera 0,500,1250,500
POINT CAMERA 0,0,0,0
If MouseClick()=1 and ObjectNumber2>0
if ORight>0
If RightCheck=0
ObCorrect=ObCorrect+1
RightCheck=1
endif
endif
if OLeft>0
If LeftCheck=0
ObCorrect=ObCorrect+1
LeftCheck=1
endif
endif
if OTop>0
If TopCheck=0
ObCorrect=ObCorrect+1
TopCheck=1
endif
endif
if OBottom>0
If BottomCheck=0
ObCorrect=ObCorrect+1
BottomCheck=1
endif
endif
if RightSideTopO>0
If RightCornerTop=0
ObCorrect=ObCorrect+1
RightCornerTop=1
endif
endif
if RightSideBottomO>0
If RightCornerBottom=0
ObCorrect=ObCorrect+1
RightCornerBottom=1
endif
endif
if LeftSideTopO>0
If LeftCornerTop=0
ObCorrect=ObCorrect+1
LeftCornerTop=1
endif
endif
if LeftSideBottomO>0
If LeftCornerBottom=0
ObCorrect=ObCorrect+1
LeftCornerBottom=1
endif
endif
`See how many objects we have in the array
NumPasses=ObCorrect+1
If ObjectNumber2>0
LOCK VERTEXDATA FOR LIMB ObjectNumber2, 0
Vcount=GET VERTEXDATA VERTEX COUNT()
For Array=1 to Vcount
VerX#=GET VERTEXDATA POSITION X(Array)
VerY#=GET VERTEXDATA POSITION Y(Array)
VerZ#=GET VERTEXDATA POSITION Z(Array)
SET VECTOR3 vector, VerX#, Very#, VerZ#
TRANSFORM COORDS VECTOR3 vector, vector, World
`calculate the correct vertices on the object to check against the others
O2X#=OBJECT POSITION X(ObjectNumber2)
O2Z#=OBJECT POSITION Z(ObjectNumber2)
VerPosX#=X VECTOR3(vector)
VerPosY#=Y VECTOR3(vector)
VerPosZ#=Z VECTOR3(vector)
Dist#=Distance#(Length, X VECTOR3(vector), Y VECTOR3(vector), Z VECTOR3(vector),PickX#, PickY#, PickZ#)
If Dist#<25.0
inc VerY#, 1
endif
If Dist#<20.0
inc VerY#, 2
endif
If Dist#<15.0
inc VerY#, 3
endif
If Dist#<10.0
inc VerY#, 4
endif
If Dist#<5.0
inc VerY#, 5
endif
SET VERTEXDATA POSITION Array, VerX#, VerY#, VerZ#
SET VECTOR3 vector, VerX#, Very#, VerZ#
TRANSFORM COORDS VECTOR3 vector, vector, World
`for the X row top
If VerPosZ#=O2Z#-(ObjSize/2)
if VerPosX#=>O2X#-(ObjSize/2)
PickX(Array)=Very#
endif
endif
`Z row left
If VerPosX#=O2X#-(ObjSize/2)
If VerPosZ#=>O2Z#-(ObjectSize/2)
PickZ(Array)=Very#
endif
endif
`X bottom
If VerPosZ#=O2Z#+(ObjSize/2)
If VerPosX#=>O2X#-(ObjSize/2)
PickXB(Array)=Very#
endif
endif
`Z right
if VerPosX#=O2X#+(ObjSize/2)
If VerPosZ#=>O2Z#-(ObjSize/2)
PickZB(Array)=Very#
endif
endif
Next Array
UNLOCK VERTEXDATA
If Oleft>0
For A=1 to Vcount
LOCK VERTEXDATA FOR LIMB Oleft, 0
VertexX#=GET VERTEXDATA POSITION X(A)
VertexY#=GET VERTEXDATA POSITION Y(A)
VertexZ#=GET VERTEXDATA POSITION Z(A)
SET VECTOR3 vector, VertexX#, VertexY#, VertexZ#
TRANSFORM COORDS VECTOR3 vector, vector, world
O2X#=OBJECT POSITION X(Oleft)
O2Z#=OBJECT POSITION Z(Oleft)
VerPosX#=X VECTOR3(1)
VerPosY#=Y VECTOR3(1)
VerPosZ#=Z VECTOR3(1)
If VerPosX#=O2X#+(ObjSize/2)
If VerPosZ#=>O2Z#-(ObjectSize/2)
SET VERTEXDATA POSITION A, VertexX#, VertexY#+PickZ(A),VertexZ
endif
endif
UNLOCK VERTEXDATA
Next A
endif
text mouseX()+10, MouseY()+10, Str$(Dist#)
endif
endif
ObCorrect=0
RightCheck=0
LeftCheck=0
TopCheck=0
BottomCheck=0
RightCornerTop=0
RightCornerBottom=0
LeftCornerTop=0
LeftCornerBottom=0
loop
Function Distance#(VecNum, x1#, y1#, z1#, x2#, y2#, z2#)
set vector3 VecNum, x2# - x1#, y2# - y1#, z2# - z1#
dist# = length vector3(VecNum)
EndFunction dist#
Quote: "short and simple preferably. "
-Sorry it's long and difficult, but to simplify would mean using more time than I have to spare at the moment. Don't eat me.
-There are some variables not doing anything - they have a use further on. Just a note that I am aware of it

HELP!
Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
