When my program calls RunObjCollisionPRO, it gets to about line 859 in NGCollision.dba, then it crashes - it gives one of those "blah.exe has encountered a problem and needs to close" windows errors.
Here's my code:
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=6
#Constant RESP_SLIDE_NO_GRAV=10
#Constant RESP_SLIDE_NO_ACCEL=18
#Constant RESP_NONE=32
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=6
#Constant DYN_RESP_LOCK_NOTURN=10
sync on
sync rate 50
load object "marble.3ds",1
load object "testmap.3ds",2
load image "flames.jpg",1
texture object 1,1
texture object 2,1
ink 0,rgb(255,255,255)
#CONSTANT type_marble=1
#CONSTANT type_level=2
#CONSTANT type_platform=3
#CONSTANT obj_marble=1
#CONSTANT obj_level=2
StartCollisionPRO( DONT POST YOUR KEYS )
StartCollisionDebugPRO()
SetCollisionsPRO(type_marble,type_level,ellip_2_poly,resp_slide,dyn_no_resp)
SetCollisionsPRO(type_marble,type_platform,ellip_2_poly,resp_slide,dyn_lock)
CollisionTypePRO(1,type_marble)
CollisionTypePRO(2,type_level)
`DEFAULTS
xrotate#=0
yrotate#=0
zrotate#=0
xpos#=0
ypos#=0
zpos#=0
xvel#=0
yvel#=0
zvel#=0
SetObjGravityPRO(1,.05)
xspin#=0
zspin#=0
ycamoff#=0
`ARRAY DEFINITIONS
dim rotdir#(2)
position object 1,0,5,0
position object 2,0,0,0
position camera 0,105,100
point camera 0,5,0
set ambient light 0
`DEFINE ENVIRONMENT HERE
`envobj(1)=2
`objeffect(1,1)=1
`objeffect(1,2)=-.5
`objeffect(1,1)=1
`PHYSICS VALUES
friccoef#=.5
jumpsize#=5
do
xrotate#=object angle x(1)
yrotate#=object angle y(1)
zrotate#=object angle z(1)
if upkey()
rotdir#(1)=rotdir#(1)-cos(ycamoff#)
rotdir#(2)=rotdir#(2)-sin(ycamoff#)
endif
if downkey()
rotdir#(1)=rotdir#(1)+cos(ycamoff#)
rotdir#(2)=rotdir#(2)+sin(ycamoff#)
endif
if rightkey()
rotdir#(2)=rotdir#(2)+cos(ycamoff#)
rotdir#(1)=rotdir#(1)+sin(ycamoff#)
endif
if leftkey()
rotdir#(2)=rotdir#(2)-cos(ycamoff#)
rotdir#(1)=rotdir#(1)-sin(ycamoff#)
endif
if spacekey()
yvel#=yvel#+jumpsize#
endif
if keystate(30)
ycamoff#=ycamoff#+1
endif
if keystate(31)
xrotate#=0
yrotate#=0
zrotate#=0
rotdir#(1)=0
rotdir#(2)=0
xpos#=0
ypos#=0
zpos#=0
xvel#=0
yvel#=0
zvel#=0
xgrav#=0
ygrav#=-.2
zgrav#=0
xspin#=0
yspin#=0
zspin#=0
ycamoff#=0
rotate object 1,0,0,0
endif
if keystate(32)
ycamoff#=ycamoff#-1
endif
ezro_set xrotate#,yrotate#,zrotate#
ezro_gx rotdir#(1)
ezro_gz rotdir#(2)
xspin#=rotdir#(1)
zspin#=rotdir#(2)
`BOUNCE/JUMP CALCULATIONS HERE
RunObjCollisionPRO(1)
hits=CountCollisionsPRO(1)
for c=1 to hits
xbounce#=CollisionHitNormPRO(1,0,1)
ybounce#=CollisionHitNormPRO(1,0,2)
zbounce#=CollisionHitNormPRO(1,0,3)
xvel#=xvel#*xbounce#
yvel#=yvel#*ybounce#
zvel#=zvel#*zbounce#
next c
`VELOCITY APPLICATIONS HERE
xpos#=xpos#+xvel#
ypos#=ypos#+yvel#
zpos#=zpos#+zvel#
text 10,10,str$(xvel#)
text 10,30,str$(yvel#)
text 10,50,str$(zvel#)
text 10,70,str$(xbounce#)
text 10,90,str$(ybounce#)
text 10,110,str$(zbounce#)
position object 1,xpos#,ypos#+5,zpos#
position camera xpos#-3*xvel#+sin(-1*ycamoff#)*50,ypos#-3*yvel#+5,zpos#-3*zvel#+cos(-1*ycamoff#)*50
point camera xpos#,ypos#+5,zpos#
sync
if shiftkey() then wait 300
while returnkey():endwhile
loop
The RunObjCollisionPRO call is on line 132.
Has anybody else had this problem before, and how did you fix it?
And, is it a problem with my computer/ngc/dbpro, or is it a problem with my code?
EDIT:
I realized that I didn't have a "RunCollisionPRO" command in there, so I added it in, but it still generates that error. Here's the new code:
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=6
#Constant RESP_SLIDE_NO_GRAV=10
#Constant RESP_SLIDE_NO_ACCEL=18
#Constant RESP_NONE=32
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=6
#Constant DYN_RESP_LOCK_NOTURN=10
sync on
sync rate 50
load object "marble.3ds",1
load object "testmap.3ds",2
load image "flames.jpg",1
texture object 1,1
texture object 2,1
ink 0,rgb(255,255,255)
#CONSTANT type_marble=1
#CONSTANT type_level=2
#CONSTANT type_platform=3
#CONSTANT obj_marble=1
#CONSTANT obj_level=2
StartCollisionPRO( DONT POST YOUR KEYS)
StartCollisionDebugPRO()
SetCollisionsPRO(type_marble,type_level,ellip_2_poly,resp_slide,dyn_no_resp)
SetCollisionsPRO(type_marble,type_platform,ellip_2_poly,resp_slide,dyn_lock)
CollisionTypePRO(1,type_marble)
CollisionTypePRO(2,type_level)
`DEFAULTS
xrotate#=0
yrotate#=0
zrotate#=0
xpos#=0
ypos#=0
zpos#=0
xvel#=0
yvel#=0
zvel#=0
SetObjGravityPRO(1,.05)
xspin#=0
zspin#=0
ycamoff#=0
`ARRAY DEFINITIONS
dim rotdir#(2)
position object 1,0,5,0
position object 2,0,0,0
position camera 0,105,100
point camera 0,5,0
set ambient light 0
`DEFINE ENVIRONMENT HERE
`envobj(1)=2
`objeffect(1,1)=1
`objeffect(1,2)=-.5
`objeffect(1,1)=1
`PHYSICS VALUES
friccoef#=.5
jumpsize#=5
RunCollisionPRO()
do
xrotate#=object angle x(1)
yrotate#=object angle y(1)
zrotate#=object angle z(1)
if upkey()
rotdir#(1)=rotdir#(1)-cos(ycamoff#)
rotdir#(2)=rotdir#(2)-sin(ycamoff#)
endif
if downkey()
rotdir#(1)=rotdir#(1)+cos(ycamoff#)
rotdir#(2)=rotdir#(2)+sin(ycamoff#)
endif
if rightkey()
rotdir#(2)=rotdir#(2)+cos(ycamoff#)
rotdir#(1)=rotdir#(1)+sin(ycamoff#)
endif
if leftkey()
rotdir#(2)=rotdir#(2)-cos(ycamoff#)
rotdir#(1)=rotdir#(1)-sin(ycamoff#)
endif
if spacekey()
yvel#=yvel#+jumpsize#
endif
if keystate(30)
ycamoff#=ycamoff#+1
endif
if keystate(31)
xrotate#=0
yrotate#=0
zrotate#=0
rotdir#(1)=0
rotdir#(2)=0
xpos#=0
ypos#=0
zpos#=0
xvel#=0
yvel#=0
zvel#=0
xgrav#=0
ygrav#=-.2
zgrav#=0
xspin#=0
yspin#=0
zspin#=0
ycamoff#=0
rotate object 1,0,0,0
endif
if keystate(32)
ycamoff#=ycamoff#-1
endif
ezro_set xrotate#,yrotate#,zrotate#
ezro_gx rotdir#(1)
ezro_gz rotdir#(2)
xspin#=rotdir#(1)
zspin#=rotdir#(2)
`BOUNCE/JUMP CALCULATIONS HERE
RunObjCollisionPRO(1)
hits=CountCollisionsPRO(1)
for c=1 to hits
xbounce#=CollisionHitNormPRO(1,0,1)
ybounce#=CollisionHitNormPRO(1,0,2)
zbounce#=CollisionHitNormPRO(1,0,3)
xvel#=xvel#*xbounce#
yvel#=yvel#*ybounce#
zvel#=zvel#*zbounce#
next c
`VELOCITY APPLICATIONS HERE
xpos#=xpos#+xvel#
ypos#=ypos#+yvel#
zpos#=zpos#+zvel#
text 10,10,str$(xvel#)
text 10,30,str$(yvel#)
text 10,50,str$(zvel#)
text 10,70,str$(xbounce#)
text 10,90,str$(ybounce#)
text 10,110,str$(zbounce#)
position object 1,xpos#,ypos#+5,zpos#
position camera xpos#-3*xvel#+sin(-1*ycamoff#)*50,ypos#-3*yvel#+5,zpos#-3*zvel#+cos(-1*ycamoff#)*50
point camera xpos#,ypos#+5,zpos#
RunCollisionPRO()
sync
if shiftkey() then wait 300
while returnkey():endwhile
loop
MOD EDIT : Dont post your keys in your code