I'm using sparkys collision dll for DBP that I got from
http://forum.thegamecreators.com/?m=forum_view&b=5&t=31051&p=0. Right now I'm using it to try and make somthing like the demo that came with it, I want to beable to place a box on another box and make a stack of them but some times when I place the box it dosn't get placed in the right spot like the intersectobject command is rounding or something.
when I place objects to the right of the axis (0,0,0) they get placed slightly to the left of the target, but if I move in a stright line and only change the X or the Z position of the camera it seems to be accruate.
here is the code I have (I comented out the media I was useing)
sync on
hide mouse
autocam off
backdrop on
color backdrop rgb(170,170,255)
position camera 0,10,0
xrotate camera 45
`load the ground texture
`load image "Ground.bmp",1
`load image "targeting ret.bmp",2
`load image "targeting ret on.bmp",3
`create the ground plain
make object plain 1,2000,2000
Xrotate object 1,270
`texture object 1,1
`scale object texture 1,40,40
color object 1,rgb(255,50,50)
SetupObject 1,1,2
`number to add to too always use a new object id
ObjID = 1
do
`camera flight
MoveCam()
`image number of the ret that will be pasted
RetMode = 2
`display debug info
text 0,0,str$(ObjID)
text 0,15,str$(screen fps())
if MouseClick() = 0 then Mouse1Pressed = 0
`make a box at target
if MouseClick() = 1 and Mouse1Pressed <> 1 or spacekey() = 1
wait 50
`make up ray start and end points
CamPosX = camera position X()
CamPosY = camera position Y()
CamPosZ = camera position Z()
move camera 500
RayEndX = camera position X()
RayEndY = camera position Y()
RayEndZ = camera position Z()
move camera -500
`THIS WAY SHOULD WORK BUT IT DOSN'T...
`RayEndX = newXvalue(CamPosX,Camera Angle Y(),1000)
`RayEndY = newYvalue(CamPosY,Camera Angle X(),1000)
`RayEndZ = newZvalue(CamPosZ,Camera Angle Y(),1000)
if intersectobject(0,1,CamPosX,CamPosY,CamPosZ,RayEndX,RayEndY,RayEndZ,0) <> 0
`get a new object id
ObjID = ObjID + 1
`make a short pillar
make object box ObjID,1,1,2
`position it
position object ObjID,GetStaticCollisionX(),GetStaticCollisionY(),GetStaticCollisionZ()
`point object ObjID,GetCollisionNormalX(1)+GetStaticCollisionX(1),GetCollisionNormalY(1)+GetStaticCollisionY(1),GetCollisionNormalZ(1)+GetStaticCollisionZ(1)
`move object ObjID,1
`set it up for collision
setupobject ObjID,1,2
`rember that the mouse is pressed
Mouse1Pressed = 1
endif
`paste the image of a turned on ret
RetMode = 3
endif
text 0,30,str$(GetStaticCollisionX())
text 0,45,str$(GetStaticCollisionY())
text 0,60,str$(GetStaticCollisionZ())
`paste the ret in the center of the screen
`paste image RetMode,screen width()/2.0 - 12.5,screen height()/2.0 - 12.5,1
sync
loop
function HandleKeyboard()
if scancode() = 18 then make object cube 10000,15
endfunction
Function MoveCam()
CameraAngleY# = camera angle y()
CameraAngleX# = camera angle x()
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*2)
Rem Control input for camera
If Upkey()=1
Move camera 1
Endif
If Downkey()=1
Move camera -1
Endif
X# = camera position X()
Y# = camera position Y()
Z# = camera position Z()
If Leftkey()=1
X# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),4)
Z# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),4)
Endif
If Rightkey()=1
X# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),4)
Z# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),4)
Endif
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,6)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,6)
Position Camera X#,Y#,Z#
endfunction
`this is never sposed to run but ya gotta have it
if memblock exist(1) then delete memblock 1
The DLL is probaly running just fine and its just my code but I dosn't know where I messed up, any help on fixing this will be appreciated