I am utterly confused. Can you even use this with objects that you created? This is my code, it doesn't work at all, and I really want to use this if only I can get it to work... This is just the freeware version, don't want to buy it unless I know how to work it.
Sync on
make object sphere 1,6
color object 1, RGB(247,252,44)
Set Global COllision Off
Load image "Vinal01.bmp",1
load dll "DBCollisions.dll",1
dllError = CheckCollisionDLL(1)
if dllError > 0 then EXIT PROMPT "Fatal ERROR with dll" , "Code " + str$(dllError): end
make matrix 1, 175, 175, 8, 8
Prepare matrix texture 1,1,1,1
Fill Matrix 1,0,1
make object box 2, 8, 15, 175
position object 2, 5,get ground height(1,5,87)-2,87
make object box 3, 175, 15, 8
position object 3, 89,get ground height(1,89,170)-2,170
make object box 4, 8, 15, 175
position object 4, 173,get ground height(1,173,87)-2,87
make object box 5, 175, 15, 8
position object 5, 89,get ground height(1,89,0)-2,0
make mesh from object 1,2 : make memblock from mesh 1,1 : MeshPtr = GET MEMBLOCK PTR(1)
OK = call dll(1, "CreateCollisionObject", MeshPtr)
make mesh from object 2,3 : make memblock from mesh 2,2 : MeshPtr = GET MEMBLOCK PTR(2)
OK = call dll(1, "CreateCollisionObject", MeshPtr)
make mesh from object 3,4 : make memblock from mesh 3,3 : MeshPtr = GET MEMBLOCK PTR(3)
OK = call dll(1, "CreateCollisionObject", MeshPtr)
make mesh from object 4,5 : make memblock from mesh 4,4 : MeshPtr = GET MEMBLOCK PTR(4)
OK = call dll(1, "CreateCollisionObject", MeshPtr)
X# = 87
Z# = 87
PrevX# = 87
PrevZ# = 87
position object 1,87,get ground height(1, 87, 87),87
position camera 87, 150, 87
point camera 87,0,87
Radius# = 80 : Gravity# = 10.0
do
REM Check to see if we're pressing up, and nothing else.
if Upkey()=1 and Downkey()=0 and Leftkey()=0 and Rightkey()=0 and Z# < 170
REM Set variables to show we're going up and nowhere else.
GoingUp = 1
GoingDown = 0
GoingLeft = 0
GoingRight = 0
endif
REM Check to see if we're pressing down, and nothing else.
if Downkey()=1 and Upkey()=0 and Leftkey()=0 and Rightkey()=0 and Z# > 5
REM Set variables to show we're going down.
GoingDown = 1
GoingUp = 0
GoingLeft = 0
GoingRight = 0
endif
REM Check to see if we're pressing left, and nothing else.
if Leftkey()=1 and Downkey()=0 and Upkey()=0 and Rightkey()=0 and X# > 5
REM Set variables to show we're going left, and nothing else.
GoingLeft = 1
GoingRight = 0
GoingUp = 0
GoingDown = 0
endif
REM Check to see if we're pressing right and nothing else.
if Rightkey()=1 and Downkey()=0 and Leftkey()=0 and Upkey()=0 and X# < 170
REM Set variables to show that we're going right and nothing else.
GoingRight = 1
GoingLeft = 0
GoingDown = 0
GoingUp = 0
endif
PrevY# = object position Y(1)
PrevX# = object position X(1)
PrevZ# = object position Z(1)
if GoingRight = 1 and X# < 170 and Colliding = 0 then X# = X# + 1
if GoingLeft = 1 and X# > 5 and Colliding = 0 then X# = X# - 1
if GoingUp = 1 and Z# < 170 and Colliding = 0 then Z# = Z# + 1
if GoingDown = 1 and Z# > 5 and Colliding = 0 then Z# = Z# - 1
bHit = call dll(1, "UpdateSlidingCollision", Radius#, Gravity#, X#, Y#, Z#, PrevX#, PrevY#, PrevZ#)
X# = call dll(1, "NewPlayerX")
Y# = call dll(1, "NewPlayerY")
Z# = call dll(1, "NewPlayerZ")
`My old, commented out collision.
`if object collision(1, 0)
`Colliding = 1
`if GoingDown = 1
`Z# = PrevZ# + 0.8
`GoingDown = 0
`Colliding = 0
`endif
`if GoingLeft = 1
` X# = PrevX# + 0.8
`GoingLeft = 0
` Colliding = 0
` endif
` if GoingRight = 1
` X# = PrevX# - 0.8
` GoingRight = 0
` Colliding = 0
` endif
` if GoingUp = 1
` Z# = PrevZ# - 0.8
` GoingUp = 0
` Colliding = 0
` endif
` endif
` And finally update the player to the new position
Position Object 1, X#, get ground height(1,X#,Z#), Z#
Sync
loop
Function CheckCollisionDLL(i)
retval = 0
if dll exist(i) = 0 then retval = 1
if dll call exist(i, "CreateCollisionObjectPro") = 0 then retval = 2
if dll call exist(i, "CreateCollisionVertex") = 0 then retval = 3
if dll call exist(i, "CreateModelLog") = 0 then retval = 4
if dll call exist(i, "DefineVerts") = 0 then retval = 5
if dll call exist(i, "GetNumFaces") = 0 then retval = 6
if dll call exist(i, "UpdateSlidingCollision") = 0 then retval = 7
if dll call exist(i, "NewPlayerX") = 0 then retval = 8
if dll call exist(i, "NewPlayerY") = 0 then retval = 9
if dll call exist(i, "NewPlayerZ") = 0 then retval = 10
if dll call exist(i, "HitNormalX") = 0 then retval = 11
if dll call exist(i, "HitNormalY") = 0 then retval = 12
if dll call exist(i, "HitNormalZ") = 0 then retval = 13
if dll call exist(i, "HitX") = 0 then retval = 14
if dll call exist(i, "HitY") = 0 Then retval = 15
if dll call exist(i, "HitZ") = 0 Then retval = 16
EndFunction retval
Yea, the code is a little messy, but I really want to use this and just can't get it to work
BTW, this is in Darkbasic Classic