Hi All
Have this large DBO model but cannot seem to get physics to work with it or debug.
might be I have too low a memory see if it will work on your system.
works ok without physics.
its long over 750 lines
Rem Project: Heavy Cargo Hauler
Rem Created: 16/06/2006 14:11:50
Rem ***** Main Source File *****
sync on
sync rate 0
phy start
phy enable debug
if file exist ("craft1.dbo")
skipenabled=1
else
skipenabled=0
endif
color backdrop 54353
set image colorkey 5,5,5
autocam off
position camera 0,0,5,-150
rem >>>>>>>>>>>>>>>>>>>>>>>>> do loop ayt 566
rem make images
rem cargo image
center text screen width()/2,screen height()/2,"Making images please wait..."
sync
sync
set text size 50
cls RGB(0,255,0)
camf(0,255,0)
box 0,80,256,120,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
ink rgb(255,255,255),0
center text 256/2,77,"Unit 7"
get image 1,0,0,256,256,1
rem engines
cls RGB(128,0,0)
for i=1 to 2000
dot rnd(256),rnd(256),rgb(12,12,12)
next i
box 0,80,256,120,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
box 115,0,140,256
box 0,246-115,256,246,RGB(128,64,64),RGB(128,64,64),RGB(128,64,64),RGB(128,64,64)
box 0,256-10,256,256
get image 2,0,0,256,256,1
rem nose cone
cls RGB(255,128,0)
camf(255,128,0)
ink rgb(255,255,255),0
text 50,120,"5"
text 193,120,"5"
get image 3,0,0,256,256,1
rem gas tank
cls RGB(255,255,0)
camf(255,255,0)
box 0,80,256,120,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
get image 4,0,0,256,256,1
cls rgb(5,5,5)
ink rgb(192,192,192),0
for i = 0 to 256 step 5
for j= 0 to 256
dot i,j
next j
next i
get image 5,0,0,256,256,1
cls RGB(0,0,255)
camf(0,0,255)
ink rgb(255,255,255),0
set text size 40
center text 256/2,256/2-40,"If It Breaks"
center text 256/2,256/2+10,"You Pay!"
get image 6,0,0,256,256,1
cls RGB(255,255,0)
box 256/2-4,0,256/2+4,256,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
box 0,0,4,256,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
box 252,0,256,256,rgb(1,1,1),rgb(1,1,1),rgb(1,1,1),rgb(1,1,1)
for i=0 to 256 step 32
box 256/2-22,i,256/2+22,i+16
box 0-22,i,0+22,i+16
box 256-22,i,256+22,i+16
get image 7,0,0,256,256,1
next i
cls 0
set text size 12
if skipenabled=1
goto start:
endif
rem make main object for control
make object sphere 1,1
make mesh from object 1,1
add limb 1,1,1
rem make frist bar in frame
make object cylinder 2,10
scale object 2,10,1000,10
roll object right 2,90
fix object pivot 2
make mesh from object 2,2
add limb 1,2,2
offset limb 1,2,0,0,-10
rem copy bar frame
make mesh from object 3,2
add limb 1,3,3
offset limb 1,3,0,0,10
delete object 2
rem make end frames
make object cylinder 4,10
scale object 4,10,205,10
make mesh from object 4,4
turn object right 4,90
roll object right 4,90
fix object pivot 4
add limb 1,4,4
offset limb 1,4,-50,0,0
rotate limb 1,4,90,0,90
rem copy it
make mesh from object 5,4
add limb 1,5,5
offset limb 1,5,50,0,0
rem copy bar for bracing bar and legthing
clone object 6,4
scale object 6,10,280,10
delete object 4
rem start of bracing
make mesh from object 6,6
add limb 1,6,6
rotate limb 1,6,0,-45,0
offset limb 1,6,-40,0,0
make mesh from object 7,6
add limb 1,7,7
rotate limb 1,7,0,45,0
offset limb 1,7,-40,0,0
rem 1/4
make mesh from object 8,6
add limb 1,8,8
rotate limb 1,8,0,45,0
offset limb 1,8,-20,0,0
make mesh from object 9,6
add limb 1,9,9
rotate limb 1,9,0,-45,0
offset limb 1,9,-20,0,0
rem middle
make mesh from object 10,6
add limb 1,10,10
rotate limb 1,10,0,-45,0
offset limb 1,10,0,0,0
make mesh from object 11,6
add limb 1,11,11
rotate limb 1,11,0,45,0
offset limb 1,11,0,0,0
rem 3/4
make mesh from object 12,6
add limb 1,12,12
rotate limb 1,12,0,45,0
offset limb 1,12,20,0,0
make mesh from object 13,6
add limb 1,13,13
rotate limb 1,13,0,-45,0
offset limb 1,13,20,0,0
rem end
make mesh from object 14,6
add limb 1,14,14
rotate limb 1,14,0,45,0
offset limb 1,14,40,0,0
make mesh from object 15,6
add limb 1,15,15
rotate limb 1,15,0,-45,0
offset limb 1,15,40,0,0
delete object 6
rem copy above rame
clone object 2,1
rem copy for side frames
clone object 3,1
rem bottom frame now linked to top frame
make mesh from object 16,2
add limb 1,16,16
offset limb 1,16,0,-5,0
scale object 3,100,25,25
rem copy frame resize then position
rem side frames
make mesh from object 17,3
add limb 1,17,17
offset limb 1,17,0,-2.5,-10
rotate limb 1,17,90,0,0
make mesh from object 18,3
add limb 1,18,18
offset limb 1,18,0,-2.5,10
rotate limb 1,18,90,0,0
delete object 2
delete object 3
clone object 2,1
make mesh from object 19,2
add limb 1,19,19
rotate limb 1,19,0,90,0
offset limb 1,19,-60,0,0
make mesh from object 20,2
add limb 1,20,20
rotate limb 1,20,0,90,0
offset limb 1,20,60,0,0
set object cull 1,1
delete object 2
make object sphere 2,10
make mesh from object 21,2
make mesh from object 22,2
make mesh from object 23,2
make mesh from object 24,2
add limb 1,21,21
offset limb 1,21,60,-2.5,50
add limb 1,22,22
offset limb 1,22,60,-2.5,-50
add limb 1,23,23
offset limb 1,23,-60,-2.5,50
add limb 1,24,24
offset limb 1,24,-60,-2.5,-50
delete object 2
rem make engines
make_object_sphere_dome(2,5,10)
make mesh from object 25,2
make object cone 3,8
make mesh from object 26,3
add limb 2,1,25
add limb 2,2,26
offset limb 2,2,0,-10,0
link limb 2,1,2
make mesh from object 27,2
add limb 1,25,27
make mesh from object 28,2
add limb 1,26,28
make mesh from object 29,2
add limb 1,27,29
make mesh from object 30,2
add limb 1,28,30
delete object 2
delete object 3
rem these limb number to rotate engeins or above spheres.
offset limb 1,25,60,-2.5,55
offset limb 1,26,60,-2.5,-55
offset limb 1,27,-60,-2.5,55
offset limb 1,28,-60,-2.5,-55
rem brigde
make object box 2,23,10,30
make mesh from object 31,2
delete object 2
add limb 1,29,31
color limb 1,29,RGB(0,0,255)
rotate limb 1,29,0,90,0
offset limb 1,29,-60,-2.5,0
rem noes cone
make object cone 3,30
scale object 3,30,120,80
rotate object 3,0,0,90
make mesh from object 32,3
add limb 1,30,32
offset limb 1,30,-85,-2.5,0
delete object 2
delete object 3
rem shaft
make object cone 2,5
make mesh from object 33,2
add limb 1,31,33
offset limb 1,31,-72,2,0
delete object 2
rem dish
make_object_halfsphere(2,5)
set object transparency 2,2
ghost object on 2,1
make mesh from object 34,2
add limb 1,32,34
delete object 2
offset limb 1,32,-72,6.7,0
rem main engines
make object sphere 2,20
make mesh from object 35,2
make mesh from object 36,2
add limb 1,33,35
add limb 1,34,36
offset limb 1,33,65,0,10
offset limb 1,34,65,0,-10
delete object 2
make_object_ConicalFrustum(2,4,6,5)
make mesh from object 37,2
add limb 1,35,37
offset limb 1,35,75,5,10
rotate limb 1,35,90,90,0
make mesh from object 38,2
add limb 1,36,38
make mesh from object 39,2
add limb 1,37,39
make mesh from object 40,2
add limb 1,38,40
make mesh from object 41,2
add limb 1,39,41
make mesh from object 42,2
add limb 1,40,42
offset limb 1,36,75,0,12.5
rotate limb 1,36,90,90,0
offset limb 1,37,75,0,7.5
rotate limb 1,37,90,90,0
offset limb 1,38,75,5,-10
rotate limb 1,38,90,90,0
offset limb 1,39,75,0,-12.5
rotate limb 1,39,90,90,0
offset limb 1,40,75,0,-7.5
rotate limb 1,40,90,90,0
delete object 2
rem make hold
make object sphere 2,1
make mesh from object 43,2
add limb 2,1,43
make object plain 3,100,20,1
texture object 3,1
rem top
make mesh from object 44,3
add limb 2,2,44
rotate limb 2,2,90,0,0
offset limb 2,2,0,10,0
rem dia side <<<<<<<<<<<<<<<<<<<<<<<<<
make mesh from object 45,3
add limb 2,3,45
scale limb 2,3,100,30,100
rotate limb 2,3,45,0,0
offset limb 2,3,0,8,-12
rem side
make mesh from object 46,3
add limb 2,4,46
offset limb 2,4,0,-4,-14
rem dia <<<<<<<<<<<<<<<<<<<<<<<<<<<
make mesh from object 47,3
add limb 2,5,47
scale limb 2,5,100,30,100
rotate limb 2,5,45,180,0
offset limb 2,5,0,8,12
rem side
make mesh from object 48,3
add limb 2,6,48
rotate limb 2,6,0,180,0
offset limb 2,6,0,-4,14
rem floor
make mesh from object 49,3
add limb 2,7,49
scale limb 2,7,100,140,100
rotate limb 2,7,-90,0,0
offset limb 2,7,0,-14,0
rem ends
make mesh from object 50,3
add limb 2,8,50
rotate limb 2,8,0,90,0
scale limb 2,8,28,100,28
offset limb 2,8,-50,-4,0
make mesh from object 51,3
add limb 2,9,51
rotate limb 2,9,0,-90,0
scale limb 2,9,28,100,28
offset limb 2,9,50,-4,0
rem gaps
make mesh from object 52,3
add limb 2,10,52
scale limb 2,10,20,20,20
rotate limb 2,10,0,-90,0
offset limb 2,10,50,8,0
make mesh from object 53,3
add limb 2,11,53
scale limb 2,11,20,20,20
rotate limb 2,11,0,90,0
offset limb 2,11,-50,8,0
rem make ends gaps left side
make object triangle 4,0, 0, 0,100, 100, 0,100, 0, 0
make mesh from object 54,4
add limb 2,12,54
scale limb 2,12,4,4,4
rotate limb 2,12,0,-90,0
offset limb 2,12,50,6,-14
make mesh from object 55,4
add limb 2,13,55
scale limb 2,13,4,4,4
rotate limb 2,13,0,90,0
offset limb 2,13,-50,6,14
delete object 4
rem make ends gaps right side
make object triangle 5,0,0,0,0,100,0,100,0, 0
make mesh from object 56,5
add limb 2,14,56
scale limb 2,14,4,4,4
rotate limb 2,14,0,-90,0
offset limb 2,14,50,6,10
make mesh from object 57,5
add limb 2,15,57
scale limb 2,15,4,4,4
rotate limb 2,15,0,90,0
offset limb 2,15,-50,6,-10
delete object 5
delete object 3
delete object 4
rem kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
rem landing struct.
add limb 1,41,2
scale limb 1,41,10,350,350
rotate limb 1,41,0,0,90
offset limb 1,41,60,-4,40
add limb 1,42,2
scale limb 1,42,10,320,320
rotate limb 1,42,0,0,90
offset limb 1,42,60,-13,40
texture limb 1,42,7
add limb 1,43,2
scale limb 1,43,10,310,310
rotate limb 1,43,0,0,90
offset limb 1,43,60,-23,40
texture limb 1,43,7
add limb 1,44,2
scale limb 1,44,10,290,290
rotate limb 1,44,0,0,90
offset limb 1,44,60,-33,40
texture limb 1,44,7
rem ......
add limb 1,45,2
scale limb 1,45,10,350,350
rotate limb 1,45,0,0,90
offset limb 1,45,60,-4,-40
add limb 1,46,2
scale limb 1,46,10,320,320
rotate limb 1,46,0,0,90
offset limb 1,46,60,-13,-40
texture limb 1,46,7
add limb 1,47,2
scale limb 1,47,10,310,310
rotate limb 1,47,0,0,90
offset limb 1,47,60,-23,-40
texture limb 1,47,7
add limb 1,48,2
scale limb 1,48,10,290,290
rotate limb 1,48,0,0,90
offset limb 1,48,60,-33,-40
texture limb 1,48,7
rem ........
add limb 1,49,2
scale limb 1,49,10,350,350
rotate limb 1,49,0,0,90
offset limb 1,49,-60,-4,40
add limb 1,50,2
scale limb 1,50,10,320,320
rotate limb 1,50,0,0,90
offset limb 1,50,-60,-13,40
texture limb 1,50,7
add limb 1,51,2
scale limb 1,51,10,310,310
rotate limb 1,51,0,0,90
offset limb 1,51,-60,-23,40
texture limb 1,51,7
add limb 1,52,2
scale limb 1,52,10,290,290
rotate limb 1,52,0,0,90
offset limb 1,52,-60,-33,40
texture limb 1,52,7
rem .................
add limb 1,53,2
scale limb 1,53,10,350,350
rotate limb 1,53,0,0,90
offset limb 1,53,-60,-4,-40
add limb 1,54,2
scale limb 1,54,10,320,320
rotate limb 1,54,0,0,90
offset limb 1,54,-60,-13,-40
texture limb 1,54,7
add limb 1,55,2
scale limb 1,55,10,310,310
rotate limb 1,55,0,0,90
offset limb 1,55,-60,-23,-40
texture limb 1,55,7
add limb 1,56,2
scale limb 1,56,10,290,290
rotate limb 1,56,0,0,90
offset limb 1,56,-60,-33,-40
texture limb 1,56,7
make_object_CubeFrustum(3,10,4,1)
make mesh from object 58,3
add limb 1,57,58
offset limb 1,57,60,-38,40
add limb 1,58,58
offset limb 1,58,60,-38,-40
add limb 1,59,58
offset limb 1,59,-60,-38,40
add limb 1,60,58
offset limb 1,60,-60,-38,-40
delete object 3
rem link em all to make it one object.
rem note when you link limbs they have a new y height.
link limb 2,1,2
link limb 2,1,3
link limb 2,1,4
link limb 2,1,5
link limb 2,1,6
link limb 2,1,7
link limb 2,1,8
link limb 2,1,9
link limb 2,1,10
link limb 2,1,11
link limb 2,1,12
link limb 2,1,13
link limb 2,1,14
link limb 2,1,15
rem offset from the sphere
offset limb 2,1,0,-20,0
texture object 2,1
for m=1 to 56
delete mesh m
next m
START:
global ypos#
ypos# =-38
if skipenabled=1
load object "craft1.dbo",1,1
load object "container.dbo",2
endif
rem neat trick here 14 objects textured in one go
rem hull box
texture object 2,1
rem engines
texture limb 1,25,2
texture limb 1,26,2
texture limb 1,27,2
texture limb 1,28,2
texture limb 1,29,6
rem nose cone
texture limb 1,30,3
rem main engines burners
texture limb 1,35,2
texture limb 1,36,2
texture limb 1,37,2
texture limb 1,38,2
texture limb 1,39,2
texture limb 1,40,2
rem engine gas tanks
texture limb 1,33,4
texture limb 1,34,4
texture limb 1,32,5,5
rem changes the size on screen
`scale object 1,50,50,50
`scale object 2,200,100,200
rem put main carft on screem
`position object 1,0,0,0
ink rgb(255,255,255),0
set object cull 1,1
ghost object on 1,6
rem place on screen
position object 1,0,45,0
position object 2,0,45,0
make object box 4,2000,1,2000
rem save objects
if skipenabled=0
save object "craft1.dbo",1
save object "container.dbo",2
endif
rem phy objects >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
phy make rigid body dynamic convex 1
phy make rigid body dynamic convex 2
phy make rigid body static box 4
make object sphere 5,29
position object 5,0,150,0
phy make rigid body dynamic sphere 5
DO
center text screen width()/2,0,"FPs="+str$(screen fps())+" Poly's="+str$(statistic(1))+" U=rise legs D=lower legs"
if object in screen(1)=1 then center text object screen x(1),object screen y(1)-25,"Craft angle X="+str$(object angle x(1))+" Y="+str$(object angle y(1))+" Z="+str$(object angle z(1))
if object in screen(1)=1 then center text object screen x(1),object screen y(1)-45,"Craft limb angle 11 X="+str$(limb angle x(1,1))+" Y="+str$(limb angle y(1,31))+" Z="+str$(limb angle z(1,31))
while keystate(22)<>0 and ypos#<-8
gearup()
`turnobject()
sync
endwhile
while keystate(32)<>0 and ypos#>-36
geardown()
`turnobject()
sync
endwhile
rem rotates sphere main object, whatever sphere does the rest follows
`turnobject()
sync
loop
rem turn model
function gearup()
offset limb 1,57,60,ypos#,40
offset limb 1,58,60,ypos#,-40
offset limb 1,59,-60,ypos#,40
offset limb 1,60,-60,ypos#,-40
if ypos#>-18
offset limb 1,42,60,ypos#+5,40
offset limb 1,46,60,ypos#+5,-40
offset limb 1,50,-60,ypos#+5,40
offset limb 1,54,-60,ypos#+5,-40
endif
if ypos#>-27
offset limb 1,43,60,ypos#+5,40
offset limb 1,47,60,ypos#+5,-40
offset limb 1,51,-60,ypos#+5,40
offset limb 1,55,-60,ypos#+5,-40
endif
offset limb 1,44,60,ypos#+5,40
offset limb 1,48,60,ypos#+5,-40
offset limb 1,52,-60,ypos#+5,40
offset limb 1,56,-60,ypos#+5,-40
inc ypos#
endfunction
function geardown()
offset limb 1,57,60,ypos#,40
offset limb 1,58,60,ypos#,-40
offset limb 1,59,-60,ypos#,40
offset limb 1,60,-60,ypos#,-40
if ypos#>-18
offset limb 1,42,60,ypos#+5,40
offset limb 1,46,60,ypos#+5,-40
offset limb 1,50,-60,ypos#+5,40
offset limb 1,54,-60,ypos#+5,-40
endif
if ypos#>-27
offset limb 1,43,60,ypos#+5,40
offset limb 1,47,60,ypos#+5,-40
offset limb 1,51,-60,ypos#+5,40
offset limb 1,55,-60,ypos#+5,-40
endif
offset limb 1,44,60,ypos#+5,40
offset limb 1,48,60,ypos#+5,-40
offset limb 1,52,-60,ypos#+5,40
offset limb 1,56,-60,ypos#+5,-40
dec ypos#
endfunction
function turnobject()
yrotate object 1,wrapvalue(object angle y(1))+.1
yrotate object 2,wrapvalue(object angle y(2))+.1
xrotate object 1,wrapvalue(object angle x(1))+.1
xrotate object 2,wrapvalue(object angle x(1))+.1
rem rotates engines
rotate limb 1,25,0,0,wrapvalue(limb angle z(1,25))+1
rotate limb 1,26,0,0,wrapvalue(limb angle z(1,26))+1
rotate limb 1,27,0,0,wrapvalue(limb angle z(1,27))+1
rotate limb 1,28,0,0,wrapvalue(limb angle z(1,28))+1
rem radar dish
rotate limb 1,32,0,wrapvalue(limb angle y(1,32))+2,0
endfunction
rem make burners
function make_object_ConicalFrustum(objno,base_r#,small_r#,height#)
make object cylinder objno, base_r#
adjust1# = height#/base_r#
adjust2# = small_r#/base_r#
lock vertexdata for limb objno, 0, 2
for V=0 to GET VERTEXDATA VERTEX COUNT()-1
RESY# = GET VERTEXDATA POSITION Y(V) * adjust1#
RESX# = GET VERTEXDATA POSITION X(V)
RESZ# = GET VERTEXDATA POSITION z(V)
if RESY# > 0
set vertexdata position V, RESX# * adjust2#, RESY#, RESZ# * adjust2#
else
set vertexdata position V, RESX#, RESY#, RESZ#
endif
NEXT V
unlock vertexdata
endfunction
function make_object_CubeFrustum(objno,base_r#,small_r#,height#)
make object cube objno, base_r#
adjust1# = height#/base_r#
adjust2# = small_r#/base_r#
lock vertexdata for limb objno, 0, 2
for V=0 to GET VERTEXDATA VERTEX COUNT()-1
RESY# = GET VERTEXDATA POSITION Y(V) * adjust1#
RESX# = GET VERTEXDATA POSITION X(V)
RESZ# = GET VERTEXDATA POSITION z(V)
if RESY# > 0
set vertexdata position V, RESX# * adjust2#, RESY#, RESZ# * adjust2#
else
set vertexdata position V, RESX#, RESY#, RESZ#
endif
NEXT V
unlock vertexdata
endfunction
function make_object_halfsphere(objno,base_r#)
make object sphere objno,base_r#
LOCK VERTEXDATA FOR LIMB objno, 0, 2
for V=0 to GET VERTEXDATA VERTEX COUNT()-1
X#=GET VERTEXDATA POSITION X(V)
if X# < 0.0 then x# = 0-x#
Y#=GET VERTEXDATA POSITION Y(V)
Z#=GET VERTEXDATA POSITION Z(V)
SET VERTEXDATA POSITION V, X#, Y#, Z#
next V
UNLOCK VERTEXDATA
endfunction
function make_object_sphere_dome(objno,base_r#,objlenght_l#)
make object sphere objno,base_r#
LOCK VERTEXDATA FOR LIMB objno, 0, 2
for V=0 to GET VERTEXDATA VERTEX COUNT()-1
y#=GET VERTEXDATA POSITION y(V)
if y# < 0.0 then y# = -objlenght_l#
x#=GET VERTEXDATA POSITION x(V)
Z#=GET VERTEXDATA POSITION Z(V)
SET VERTEXDATA POSITION V, X#, Y#, Z#
next V
UNLOCK VERTEXDATA
endfunction
function camf(r,g,b)
for a = 1 to 5000
bsize=rnd(10)+3
asize=rnd(10)+3
ink rgb(rnd(r),rnd(g),rnd(b)),0
x=rnd(256):y=rnd(256)
ELLIPSE X,Y,asize,asize
box x,y,x+bsize,y+bsize
next a
endfunction
edit
add () to file name should work right now.
Dark Physics makes any hot drink go cold.