Here are some comments. Hope it helps.
sync on
`*************************************************************************
` Always put this command and these constants at the top of your program *
`*************************************************************************
startcollisionpro(0,0,0)
#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=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_NONE=5
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=3
#Constant DYN_RESP_LOCK_NOTURN=4
`********************************************
` create constants for your collision types *
`********************************************
#Constant Box_Type=1
#Constant Sphere_Type=2
`randomize
randomize timer()
`make particles
make particles 1,1,20,5
`make matrix and randomize
make matrix 1,10000,10000,100,100
randomize matrix 1,20
`if you are using DBPro then you also need to update the matrix
update matrix 1
`make main character
make object cube 1,10
`define ground level
cubey# = get ground height(1, cubex#, cubez#) + 20
`make spheres randomly
for i=2 to 10
make object sphere i,5
position object i,rnd(200),cubey#,rnd(200)
next i
`**************************************************************************
` Make sure you setup your collisions after the objects have been created *
`**************************************************************************
`******************************************
` setup your player (Box_Type) to collide *
` with your spheres (Sphere_Type) but not *
` affect the boxes movement (RESP_NONE) *
`******************************************
SetCollisionsPro( Box_Type, Sphere_Type, ELLIP_2_POLY, RESP_NONE, DYN_NO_RESP )
`**********************************************************
` setup up which ellipsize you want to use when 2 ellips *
` of different sizes collide. Not needed for your program *
` yet as you only have one ellip to test (the player) *
` but you will probably need it in the future for testing *
` between many moving objects *
`**********************************************************
SetEllipSizeModePRO(1)
`***********************************************
` set your objects to a collision type and set *
` a radius if it will be tested as an ellip *
`***********************************************
CollisionTypePRO( 1, Box_Type )
SetObjRadiusPRO( 1, 10, 10, 10 )
for i=2 to 10
CollisionTypePRO( i, Sphere_Type )
next i
`begin loop
do
`*********************************************
` I turned this off as with NGC you will not *
` be needing DBP's built in commands *
`*********************************************
`collision for main character
`automatic object collision 1,1,1
position particles 1,cubex#,cubey#+4,cubez#
color particles 1,rnd(256),0,rnd(256)
`
cubey# = get ground height(1, cubex#, cubez#) + 10
`move cube
if downkey()=1
z1# = - 0.5
else
z1# = 0.5
endif
if rightkey()=1 then angle#=wrapvalue(angle#+2.5)
if leftkey()=1 then angle#=wrapvalue(angle#-2.5)
if spacekey()=1 then cubey#=cubey#+5
if shiftkey()=1 then cubey#=cubey#-1
if spacekey()=1 and shiftkey()=1 then cubey#=cubey#+10
`****************************************************
` This section gets the bumber of collisions for *
` Your player object (#1) with CountCollisionsPRO() *
` Then it cycles through each collision to see what *
` Object it hit with CollisionHitObj() and attaches *
` It to the player using glue object to limb *
` ***************************************************
rem Get number of collisions for object
collCount = CountCollisionsPRO( 1 )
rem goes through each collision
for t=1 to collCount
rem Gets the object that was hit
hitObj = CollisionHitObj( 1, t )
if hitObj>1 then glue object to limb hitObj,1,0 : DeActivateObjPRO( hitObj )
next t
`**********************************************************
` I commented this out as well as the section before this *
` Only test objects that are actually hitting the player *
`**********************************************************
`for i = 2 to 10
`if object collision(1,i)=1 then glue object to limb 1,0,i
`next i
x#=cubex#
z#=cubez#
cubex#=newxvalue(cubex#,angle#,z1#)
cubez#=newzvalue(cubez#,angle#,z1#)
rotate object 1,0,angle#,0
position object 1,x#,cubey#,z#
point camera x#,cubey#,z#
rem Smooth control camera
cdx#=newxvalue(x#,angle#,-75)
cdz#=newzvalue(z#,angle#,-75)
cdy#=get ground height(1,cx#-mx#,cz#-mz#)+1
if cdy#<32 then cdy#=32
cx#=curvevalue(cdx#,cx#,5)
cy#=curvevalue(cdy#,cy#,5)
cz#=curvevalue(cdz#,cz#,5)
position camera cx#,cy#,cz#
point camera cubex#,get ground height(1,cubex#-mx#,cubez#-mz#)+1,cubez#
`sync and end loop
`I added this to print what object was hit
`these next 2 lines can be deleted
set cursor 5,5
print hitObj
`*********************************************************
` Call this once per loop to update the collision system *
`*********************************************************
RunCollisionPRO()
sync
loop
function gravity(Pull)
for a = 1 to 500
if object exist(a)
if object position y(a)>0 then move object down a,Pull
endif
next a
endfunction
[edit] Ellip collision is where a ellipsoid is created for the actual collision for the object. Its size is determined by setobjradiuspro().
Poly collision is where you test the actual polygons of the model to see if they are hitting the ellip.
Also NGC will only test from an ellip to an ellip or from an ellip to poly in the v2.** series. One of your objects has to be an ellip. Ellip collision is faster than poly so you could set both of them to ellip but with such small objects I don't think it will matter much. You only get a boost from checking very complex objects as ellips.
Also the ellip will not rotate with the player in this series of NGC either. Hopefully alot of this will change with the v3.** series.
[edit2] Sticky response is like DBP's built in collision I believe. Meaning the 2 objects will not slide against one another but will stop dead in their tracks when they collide. I think this is correct. I have never had to use sticky collision.