Posted: 28th May 2003 23:04
hi
here a little example of miror...and...the begening of a 3d Camera like Mario 64
it still does not respect the reflexion physic....but....



+ Code Snippet
sync on
sync rate 0
hide mouse
backdrop on : color backdrop rgb(150,100,0)
create bitmap 1,1024,1024
ink rgb(100,0,0),0
box 0,0,512,512
ink rgb(0,100,0),0
box 512,0,1023,512
ink rgb(0,0,100),0
box 0,512,512,1023
ink rgb(0,0,0),0
box 512,512,1023,1023
get image 1,0,0,1024,1024
delete bitmap 1

make matrix 1,5000,5000,20,20
prepare matrix texture 1,1,1,1
fill matrix 1,0,0


rem ------------------------------------------------
rem corps
make object box 1,100,200,100
rem bras
make object box 2,30,100,30
make mesh from object 1,2
delete object 2
rem jambe
make object box 2,30,100,30
make mesh from object 2,2
delete object 2
rem point de rotation
make object plain 2,1,1
make mesh from object 3,2
delete object 2

rem faire un object pour le corps....pour collision
make mesh from object 4,1
make object 2,4,0
delete mesh 4

rem adder les bras/jambe au perso
make object 10,2,0
for i=1 to 4
   add limb 1,i,1
next i
rem adder les jambes au perso
for i=1 to 4
   add limb 1,i+4,2
next i
rem adder les point de rotation au perso
for i=9 to 16
   add limb 1,i,3
next i
rem fixer les bras/jambe aux point de rotation
for i=1 to 8
   link limb 1,i,i+8
next i
rem fixer les point de rotation aux.....membre ki les font bouger..
for i=1 to 4
   link limb 1,8+(2*i),(i*2)-1
next i
rem offsetter les bras/jambe de leur point de rotation
for i=1 to 8
   offset limb 1,i,0,-50,0
next i
rem offset les bras/jambe ...du bas ..par rapport..a leur bras/jambe du haut
for i=1 to 4
   offset limb 1,8+(i*2),0,-50,0
next i
rem POSITIONNEMENT FINAL: mettre les bras/jambe a la bonne place (en positionnant seulemnt leur point de rotation)
offset limb 1,9,-60,100,0
offset limb 1,11,60,100,0
offset limb 1,13,-40,-100,0
offset limb 1,15,40,-100,0
rem Tete
make mesh from object 4,10
add limb 1,17,4
offset limb 1,17,0,125,0


set object rotation ZYX 1

clear all object keyframes 1
i=1:rotate limb 1,8+((i*3)-(3-i)),45,90,0:rotate limb 1,10+((i*3)-(3-i)),45,270,0:set object keyframe 1,0
rotate limb 1,13,45,0,0:rotate limb 1,14,315,0,0:rotate limb 1,9,45,45,0:rotate limb 1,11,315,90,0:set object keyframe 1,10
rotate limb 1,13,0,0,0:rotate limb 1,14,0,0,0:rotate limb 1,15,45,0,0:rotate limb 1,16,315,0,0:rotate limb 1,9,45,90,0:rotate limb 1,11,315,135,0:set object keyframe 1,20
rotate limb 1,15,0,0,0:rotate limb 1,16,0,0,0:rotate limb 1,13,45,0,0:rotate limb 1,14,315,0,0:rotate limb 1,9,45,45,0:rotate limb 1,11,315,90,0:set object keyframe 1,30
rem -------------------------------------------
delete object 10
delete object 2
x#=2500
z#=2500
y#=0
ink rgb(255,255,255),0
Direction=0

make object plain 100,640.0*0.85,480.0*0.85
position object 100,2500,object size y(100)/2,4500
yrotate object 100,180
make object plain 101,640.0*0.85,480.0*0.85
position object 101,2500,object size y(100)/2,4500+3

position object 1,x#,y#+90,z#
position camera x#,y#+150,z#
rotate camera 25,ay#,0
move camera -250

scale object 1,30,30,30
yrotate object 1,180
fix object pivot 1



do
   NbTouche=LeftKey()+RightKey()+Upkey()+Downkey()

   if (upkey()) and (NbTouche=1) then Direction=1
   if (downkey()) and (NbTouche=1) then Direction=5
   if (leftkey()) and (NbTouche=1)  then Direction=7
   if (rightkey()) and (NbTouche=1) then Direction=3
   if (upkey()) and (leftkey()) (NbTouche=2) then Direction=8
   if (upkey()) and (rightkey()) (NbTouche=2) then Direction=2
   if (downkey()) and (rightkey()) (NbTouche=2) then Direction=4
   if (downkey()) and (leftkey()) (NbTouche=2) then Direction=6



   Difx#=camera position x()-x#
   Difz#=camera position z()-z#
   CamAng#=atanfull(Difx#,Difz#)
   Camx#=newxvalue(x#,CamAng#,500)
   Camz#=newzvalue(z#,CamAng#,500)

   if direction<>0
      if object looping(1)=0 then loop object 1,10,30
      ay#=wrapvalue(((Direction-1)*45)+(CamAng#-180))
      x#=newxvalue(x#,ay#,10)
      z#=newzvalue(z#,ay#,10)
      direction=0
   else
      stop object 1
   endif


   yrotate object 1,ay#
   position object 1,x#,y#+90,z#



   if sqrt((camera position x()-x#)^2+(camera position z()-z#)^2)>500 then Position Camera CamX#,camera position y(),CamZ#
   point camera x#,y#+150,z#


   oldcamx#=camera position x()
   oldcamy#=camera position y()
   oldcamz#=camera position z()
   oldcamay#=camera angle y()
   oldcamax#=camera angle x()
   oldcamaz#=camera angle z()
   position camera 2500,200,4500+300
   rotate camera 0,180,0
   hide object 100
   hide object 101
   if object position z(1)>4500 then hide object 1
   if Update=1
      get image 100,0,0,64*2,48*2
      texture object 100,100
      paste image 200,0,0
      set camera view 0,0,64*2,48*2
      Update=0
   endif
   set cursor 0,0
   print Screen Fps()
   position camera oldcamx#,oldcamy#,oldcamz#
   rotate camera oldcamax#,oldcamay#,oldcamaz#
   show object 100
   show object 101
   show object 1
   if timer()-tps>300
      get image 200,0,0,64*2,48*2
      tps=timer()
      Update=1
   endif
   set camera view 0,0,640,480
   sync
loop
Posted: 28th May 2003 23:07
sorry.......first one was not working...now it work
this is the code:
+ Code Snippet
sync on
sync rate 0
hide mouse
backdrop on : color backdrop rgb(150,100,0)
create bitmap 1,1024,1024
ink rgb(100,0,0),0
box 0,0,512,512
ink rgb(0,100,0),0
box 512,0,1023,512
ink rgb(0,0,100),0
box 0,512,512,1023
ink rgb(0,0,0),0
box 512,512,1023,1023
get image 1,0,0,1024,1024
delete bitmap 1

make matrix 1,5000,5000,20,20
prepare matrix texture 1,1,1,1
fill matrix 1,0,0


rem ------------------------------------------------
rem corps
make object box 1,100,200,100
rem bras
make object box 2,30,100,30
make mesh from object 1,2
delete object 2
rem jambe
make object box 2,30,100,30
make mesh from object 2,2
delete object 2
rem point de rotation
make object plain 2,1,1
make mesh from object 3,2
delete object 2

rem faire un object pour le corps....pour collision
make mesh from object 4,1
make object 2,4,0
delete mesh 4

rem adder les bras/jambe au perso
make object 10,2,0
for i=1 to 4
   add limb 1,i,1
next i
rem adder les jambes au perso
for i=1 to 4
   add limb 1,i+4,2
next i
rem adder les point de rotation au perso
for i=9 to 16
   add limb 1,i,3
next i
rem fixer les bras/jambe aux point de rotation
for i=1 to 8
   link limb 1,i,i+8
next i
rem fixer les point de rotation aux.....membre ki les font bouger..
for i=1 to 4
   link limb 1,8+(2*i),(i*2)-1
next i
rem offsetter les bras/jambe de leur point de rotation
for i=1 to 8
   offset limb 1,i,0,-50,0
next i
rem offset les bras/jambe ...du bas ..par rapport..a leur bras/jambe du haut
for i=1 to 4
   offset limb 1,8+(i*2),0,-50,0
next i
rem POSITIONNEMENT FINAL: mettre les bras/jambe a la bonne place (en positionnant seulemnt leur point de rotation)
offset limb 1,9,-60,100,0
offset limb 1,11,60,100,0
offset limb 1,13,-40,-100,0
offset limb 1,15,40,-100,0
rem Tete
make mesh from object 4,10
add limb 1,17,4
offset limb 1,17,0,125,0


set object rotation ZYX 1

clear all object keyframes 1
i=1:rotate limb 1,8+((i*3)-(3-i)),45,90,0:rotate limb 1,10+((i*3)-(3-i)),45,270,0:set object keyframe 1,0
rotate limb 1,13,45,0,0:rotate limb 1,14,315,0,0:rotate limb 1,9,45,45,0:rotate limb 1,11,315,90,0:set object keyframe 1,10
rotate limb 1,13,0,0,0:rotate limb 1,14,0,0,0:rotate limb 1,15,45,0,0:rotate limb 1,16,315,0,0:rotate limb 1,9,45,90,0:rotate limb 1,11,315,135,0:set object keyframe 1,20
rotate limb 1,15,0,0,0:rotate limb 1,16,0,0,0:rotate limb 1,13,45,0,0:rotate limb 1,14,315,0,0:rotate limb 1,9,45,45,0:rotate limb 1,11,315,90,0:set object keyframe 1,30
rem -------------------------------------------
delete object 10
delete object 2
x#=2500
z#=2500
y#=0
ink rgb(255,255,255),0
Direction=0

make object plain 100,640.0*0.85,480.0*0.85
position object 100,2500,object size y(100)/2,4500
yrotate object 100,180
make object plain 101,640.0*0.85,480.0*0.85
position object 101,2500,object size y(100)/2,4500+3

position object 1,x#,y#+90,z#
position camera x#,y#+150,z#
rotate camera 25,ay#,0
move camera -250

scale object 1,30,30,30
yrotate object 1,180
fix object pivot 1



do
   NbTouche=LeftKey()+RightKey()+Upkey()+Downkey()

   if (upkey()) and (NbTouche=1) then Direction=1
   if (downkey()) and (NbTouche=1) then Direction=5
   if (leftkey()) and (NbTouche=1)  then Direction=7
   if (rightkey()) and (NbTouche=1) then Direction=3
   if (upkey()) and (leftkey()) (NbTouche=2) then Direction=8
   if (upkey()) and (rightkey()) (NbTouche=2) then Direction=2
   if (downkey()) and (rightkey()) (NbTouche=2) then Direction=4
   if (downkey()) and (leftkey()) (NbTouche=2) then Direction=6



   Difx#=camera position x()-x#
   Difz#=camera position z()-z#
   CamAng#=atanfull(Difx#,Difz#)
   Camx#=newxvalue(x#,CamAng#,500)
   Camz#=newzvalue(z#,CamAng#,500)

   if direction<>0
      if object looping(1)=0 then loop object 1,10,30
      ay#=wrapvalue(((Direction-1)*45)+(CamAng#-180))
      x#=newxvalue(x#,ay#,10)
      z#=newzvalue(z#,ay#,10)
      direction=0
   else
      stop object 1
   endif


   yrotate object 1,ay#
   position object 1,x#,y#+90,z#



   if sqrt((camera position x()-x#)^2+(camera position z()-z#)^2)>500 then Position Camera CamX#,camera position y(),CamZ#
   point camera x#,y#+150,z#


   oldcamx#=camera position x()
   oldcamy#=camera position y()
   oldcamz#=camera position z()
   oldcamay#=camera angle y()
   oldcamax#=camera angle x()
   oldcamaz#=camera angle z()
   position camera 2500,200,4500+300
   rotate camera 0,180,0
   hide object 100
   hide object 101
   if object position z(1)>4500 then hide object 1
   if Update=1
      get image 100,0,0,64*2,48*2
      texture object 100,100
      paste image 200,0,0
      set camera view 0,0,64*2,48*2
      Update=0
   endif
   set cursor 0,0
   print Screen Fps()
   position camera oldcamx#,oldcamy#,oldcamz#
   rotate camera oldcamax#,oldcamay#,oldcamaz#
   show object 100
   show object 101
   show object 1
   if timer()-tps>300
      get image 200,0,0,64*2,48*2
      tps=timer()
      Update=1
   endif
   set camera view 0,0,640,480
   sync
loop
Posted: 29th May 2003 0:05
for those who do not have DBC then exe is here:

http://membres.lycos.fr/brainwasher666/

its "mirror.zip"