@Tv Xxx
I can't seem to download any attachments from the forums lately, not sure why - only if they are posted in a link that's not on the tgc server. Anyway, not being able to look at your code I'll guess at a couple of things that may or may not apply.
I think sparky's collision is entirely based on projecting a ray from a start point to an end point and checking for when the ray intersects a plane (when the ray passes through a mesh). Every iteration, whenever you reposition, scale, or rotate your objects, the objects are made into a mesh, loaded into a memblock, a pointer from the memblock is sent to the dll, and the intersection calculation is performed.
So the important things are that:
1. you are calling the update function from sparky's library regularly whenever your objects are changing position/rotation
2. you are using an approriate collision method = sphere/box/poly
3. you have groups and individual items set up properly for detection
4. And you are casting the ray from the right place to the right place.
For number 4
The following example shows a ray using sparkys dll being cast from inside a cube. If you move the arrow keys, left or right, you will change the start position and length of the ray. Whether there is collision or not will be displayed. If your pool game has objects that would end up in between where this ray is cast (including the table) or if one object is made of two object on top of or next to each other and the ray passes through one of them, the collision detection will flag positive.
I put the example together just so you can get a visual. Sometimes it helps just to see the process.
sync on
sync rate 60
autocam off
rem include Sparky's DLL
#INCLUDE "DBCcollisions.dba"
make object cube 1,25
set object 1,0,1,0
rem setup collision
setupObjectDBC(1,0,0)
rem make two spheres to track the start and end position of the ray
make object sphere 2,5
turn object left 2,90
make object sphere 3,5
position object 3,-100,0,0
position camera -50,0,-120
do
rem move the object from inside the cube
if leftkey()=1 then move object 2,.5
if rightkey()=1 then move object 2,-.5
oldx#=object position x(2)
oldy#=object position y(2)
oldz#=object position z(2)
x#=object position x(3)
y#=object position y(3)
z#=object position z(3)
ink rgb(255,0,0),0
line object screen x(2),object screen y(2),object screen x(3),object screen y(3)
text object screen x(2),object screen y(2)-30,"Start of ray"
text object screen x(3),object screen y(3)-30,"End of ray"
rem as the distance between the spheres changes, change
rem the length and position of the ray and detect the collision
rem of the cube
result=intersectObjectDBC(1,0,oldx#,oldy#,oldz#,x#,y#,z#,0)
ink rgb(255,255,255),0
if result=1
text 0,0,"The ray is passing through the cube"
else
text 0,0,"The ray is NOT passing through the cube"
endif
sync
loop
Enjoy your day.