From an advice from ruccus, i made this thread here hoping for more answers.. ( http://forum.thegamecreators.com/?m=forum_view&t=96693&b=7 )
sorry to be making another thread about collision so quick, but i really just want to learn..
Here is the current code:
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
#include functions.dba
`Make player object
MAKE OBJECT CUBE 1,10
setupObjectDBC(1,0,0)
`Make a laser object (has no effect on the collision, just visual junk)
MAKE OBJECT BOX 2,200,1,1
COLOR OBJECT 2,RGB(255,000,000)
GHOST OBJECT ON 2
POSITION OBJECT 2,0,0,50
`Orient the camera
POSITION CAMERA 0,100,0
POINT CAMERA 0,0,0
`Main loop
DO
`Object movement
If upkey()=1 then move object 1,3
`Update the player object after its moved
updateObjectDBC(1)
`Now we detect for intersection
C# = intersectObjectDBC(1,0,-100,0,50,100,0,50,0)
`If an intersection occured (meaning C# must be greater than 0)
IF C#
`Display "HIT!"
TEXT 0,0,"HIT!"
ENDIF
`Refresh the screen
SYNC
`Repeat
LOOP
`Include this command for sparky's dll to work
DELETE MEMBLOCK 1
And here is the functions.dba:
function setupObjectDBC(objNum,groupNum,objectType)
commonSetup(objNum)
vertData = get memblock ptr(254)
objectData = get memblock ptr(255)
call dll 1,"setupObject",objNum,groupNum,objectType,vertData,objectData
delete memblock 254
endfunction
function setupComplexObjectDBC(objNum,groupNum,facesPerNode)
commonSetup(objNum)
vertData = get memblock ptr(254)
objectData = get memblock ptr(255)
call dll 1,"setupComplexObject",objNum,groupNum,facesPerNode,vertData,objectData
delete memblock 254
endfunction
function commonSetup(objNum)
if dll exist(1)=0 then load dll "DBCcollision.dll",1
if memblock exist(255)=0 then make memblock 255,24
x#=object position x(objNum)
y#=object position y(objNum)
z#=object position z(objNum)
angx#=object angle x(objNum)
angy#=object angle y(objNum)
angz#=object angle z(objNum)
write memblock float 255,0,x#
write memblock float 255,4,y#
write memblock float 255,8,z#
write memblock float 255,12,angx#
write memblock float 255,16,angy#
write memblock float 255,20,angz#
position object objNum,0,0,0
rotate object objNum,0,0,0
make mesh from object 255,objNum
make memblock from mesh 254,255
delete mesh 255
position object objNum,x#,y#,z#
rotate object objNum,angx#,angy#,angz#
endfunction
function updateObjectDBC(objNum)
if memblock exist(255)=0 then make memblock 255,24
write memblock float 255,0,object position x(objNum)
write memblock float 255,4,object position y(objNum)
write memblock float 255,8,object position z(objNum)
write memblock float 255,12,object angle x(objNum)
write memblock float 255,16,object angle y(objNum)
write memblock float 255,20,object angle z(objNum)
objectData = get memblock ptr(255)
call dll 1,"updateObject",objNum,objectData
endfunction
function intersectObjectDBC(objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
collide=call dll(1,"intersectObject",objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
endfunction collide
function setObjectCollisionOnDBC(objNum)
call dll 1,"set_object_collision_on",objNum
endfunction
function setObjectCollisionOffDBC(objNum)
call dll 1,"set_object_collision_off",objNum
endfunction
function collisionStatusDBC(objNum)
result=call dll(1,"collisionstatus",objNum)
endfunction result
function getStaticCollisionX()
result#=call dll(1,"getStaticCollisionX")
endfunction result#
function getStaticCollisionY()
result#=call dll(1,"getStaticCollisionY")
endfunction result#
function getStaticCollisionZ()
result#=call dll(1,"getStaticCollisionZ")
endfunction result#
function getCollisionNormalX()
result#=call dll(1,"getCollisionNormalX")
endfunction result#
function getCollisionNormalY()
result#=call dll(1,"getCollisionNormalY")
endfunction result#
function getCollisionNormalZ()
result#=call dll(1,"getCollisionNormalZ")
endfunction result#
Ok, i wanted to learn how to use sparky's dll with dbc so i asked on the newcommers board. Ruccus showed me this code and i learned much from what he showed me. now, when i compile his code i get a parameter mismatch error. And i dont know why it is happening. if anyone knows why please tell me because i really need to know how to use sparky's dll to make games.. oh and if anyone can tell me what the oldx#,oldy#,oldz#,x#,y#,z# stand for and how do i know what numbers to put in there..
so to explain this in a few words, the problem i have is the parameter mismatch error i get. I cant figure out why it happens..

i like pancakes..