@BlackChaos. Sorry for the delay, but I hadn't see your post until now.You have to make the ellipse with other object, or a group of objects around the main object selector.
ink rgb(130,100,0),1
box 0,0,50,50
ink rgb(100,80,0),1
box 5,5,45,45
get image 1,0,0,50,50
cls
autocam off:sync on:hide mouse
color backdrop rgb(100,100,255)
set ambient light 10
hide light 0
make light 1
position light 1,50,20,50
make matrix 1,100,100,20,20
prepare matrix texture 1,1,1,1
make object box 10,100,0,100:color object 10,rgb(0,110,100):position object 10,50,-0.2,50
`mouse reference ...two objects ....one to get x,z and second for show mouse position
make object sphere 1000,0.1 `se posiciona en el objecto 101(target de la camara)
make object sphere 1,1:color object 1,rgb(255,0,0) `muestra el punto x,z seleccionado
set object emissive 1,rgb(255,0,0)
`objeto para intersectar y estar seguros de que estamos dentro de la matrix.Lo hacemos mucho mas grande que la matrix,para
`estar seguros de que cogera todos los vertices de la matrix.Mas adelante le ponemos topes arriba abajo izquierda y derechha.
make object box 100,200,0,200:hide object 100
position object 100,50,0,50
make object box 101,2,2,2 :hide object 101 `target de la camara
`starting values
punto=1
px=150
py=50
position mouse px,py
for i= 2000 to 2200
make object box i,0.2,0,0.2
color object i,rgb(0,255,0):set object emissive i,rgb(0,255,0)
next i
do
`guardamos la posicion de la camara antes de moverse
x=camera position x()
y=camera position y()
z=camera position z()
`movemos la camara hacia adelante para trazar un rayo imaginario
move camera 800
`volvemos a obtener las posiciones de la camara despues de haberse movido
nx=camera position x()
ny=camera position y()
nz=camera position z()
`posicionamos al objeto target en las coodenadas actuales de la camara
position object 101,camera position x(),camera position y(),camera position z()
rem endif
`comprobamos si existe interseccion entre la camara y la pantalla oculta (objeto 100), y obtenemos la distancia
if intersect object(100,x,y,z,nx,ny,nz)>0
distancia#=intersect object(100,x,y,z,nx,ny,nz)
endif
`movimientos de la camara
if upkey()=1 THEN x#=NEWXVALUE(x#,gira#,0.1):z#=NEWZVALUE(z#,gira#,0.1)
if downkey()=1 THEN x#=NEWXVALUE(x#,gira#,-0.1):z#=NEWZVALUE(z#,gira#,-0.1)
if leftkey()=1 THEN x#=NEWXVALUE(x#,gira#-90,0.1)
if leftkey()=1 then z#=NEWZVALUE(z#,gira#-90,0.1)
if rightkey()=1 THEN x#=NEWXVALUE(x#,gira#-90,-0.1)
if rightkey()=1 then z#=NEWZVALUE(z#,gira#-90,-0.1)
gira#=wrapvalue(gira#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
`posicion de la camara con respecto a la matrix
position camera x#,25,z#
rotate camera cam#,gira#,0
if cam#<=290 and cam#>180 then cam#=290
if cam#>=70 and cam#<180 then cam#=70
`si existe interseccion, movemos al objeto target la distancia obtenida para colocarlo sobre la matrix, y asi hacer la comprobacion
if intersect object(100,x,y,z,nx,ny,nz)>0
position object 101,x,camera position y(),z
rotate object 101,cam#,gira#,0
move object 101,distancia#
endif
ink rgb(255,255,255),0
set cursor 1,1
print "H help"
if inkey$()="h" or inkey$()="H" then gosub ayuda
if controlkey()
gosub salva
endif
`Conditions to make snap to grid
obx=object position x(101)
obz=object position z(101)
if obx>px then inc px,5
if obx<px then dec px,5
if obz>py then inc py,5
if obz<py then dec py,5
if py>95 then py=95
if px>95 then px=95
if px<5 then px=5
if py<5 then py=5
position object 1000,px,0,py
ox=object position x(1000)/5
oz=object position z(1000)/5
`mouse 1 increase height mouse 2 decrease height
if mouseclick()=1 then hg#=hg#+0.001
if mouseclick()=2 then hg#=hg#-0.001
if mouseclick()=0 then hg#=0
heigh#=get matrix height (1,ox,oz)
heigh1#=get matrix height (1,ox-1,oz)
heigh2#=get matrix height (1,ox+1,oz)
heigh3#=get matrix height (1,ox,oz-1)
heigh4#=get matrix height (1,ox,oz+1)
if mouseclick()
set matrix height 1,ox,oz,heigh#+hg#
set matrix height 1,ox-1,oz,heigh1#+hg#/2
set matrix height 1,ox+1,oz,heigh2#+hg#/2
set matrix height 1,ox,oz-1,heigh3#+hg#/2
set matrix height 1,ox,oz+1,heigh4#+hg#/2
sleep 10
update matrix 1
endif
position object 1,object position x(1000),heigh#,object position z(1000)
for i= 2000 to 2200
position object i,object position x(1),1,object position z(1)
yrotate object i,i*1.8
move object i,6
cix#=object position x(i)
ciz#=object position z(i)
alt#=get ground height(1,cix#,ciz#)
position object i,cix#,alt#+0.1,ciz#
next i
sync
loop
salva:
`creamos un bitmap para generar un hightmap y guardarlo como jpg
create bitmap 1,99,99
for i= 0 to 100
for a= 0 to 100
alt=get ground height(1,i,a)+55
ink rgb(alt,alt,alt),0
dot i,100-a
next a
next i
get image 3,0,0,bitmap width(1),bitmap height(1),1
`CREAMOS UN BITMAP DESTINO DONDE PEGAR (EN ESTE CASO LO VAMOS A ampliar A 128 x 128
create bitmap 2,128,128
`COPIAMOS EL CONTENIDO DEL BITMAP 1 Y LO PEGAMOS EN EL BITMAP 2
copy bitmap 1,0,0,bitmap width(1),bitmap height(1),2,0,0,128,128
`OBTENEMOS LA PORSION DE IMAGEN DE 128*128 y finalmente borramos los dos bitmaps
get image 2,0,0,128,128,1
delete bitmap 1
delete bitmap 2
sleep 200
save image "heightmap2.jpg",2
return
ayuda:
set cursor 0,0
print
print
ink rgb(0,0,100),1
box 48,98,602,202
ink rgb(130,130,130),0
box 50,100,600,200
ink rgb(255,255,255),0
set cursor 52,120
print "Mouse 1 increase height CHAFARI Terrain Editor "
set cursor 52,136
print "Mouse 2 decrease height "
set cursor 52,151
print "Press Controlkey to save matrix to Bmp"
return
Cheers.
I'm not a grumpy grandpa
