Yeah, doesn't interfere with DP.
The x-z1 are the points you record before the movement. The x-z2 are after the movement. Take a look at my game loop:
do
PreviousCycleTime = CycleTime
CycleTime = timer()
ElapsedTime = CycleTime - PreviousCycleTime
CyclesPerSecond# = 1000.0 / ElapsedTime
oldx#=object position x(PlayerObject)
oldy#=object position y(PlayerObject)
oldz#=object position z(PlayerObject)
`=====WASD Controls=====
if keystate(17)=1 then move object PlayerObject, MovementSpeed# / CyclesPerSecond#
if keystate(30)=1 then move object left PlayerObject, MovementSpeed# / CyclesPerSecond#
if keystate(31)=1 then move object PlayerObject, 0.0 - (MovementSpeed# / CyclesPerSecond#)
if keystate(32)=1 then move object right PlayerObject, MovementSpeed# / CyclesPerSecond#
`=====WASD Controls=====
x#=object position x(PlayerObject)
y#=object position y(PlayerObject)
z#=object position z(PlayerObject)
`=====Camera/Player Obj Lock=====
position camera object position x(PlayerObject),object position y(PlayerObject),object position z(PlayerObject)
rotate camera camera angle x(),object angle y(PlayerObject),camera angle z()
`=====Camera/Player Obj Lock=====
`=====Camera Controls=====
speed#=0.2
damper#=10.0
camy#=wrapvalue(camy#+mousemovex()*speed#):camx#=wrapvalue(camx#+mousemovey()*speed#)
if camx#<=290 and camx#>180 then camx#=290
if camx#>=70 and camx#<180 then camx#=70
tx#=curvevalue(-camx#,tx#,damper#)
ty#=curvevalue(-camy#,ty#,damper#)
rotate camera camx#,object angle y(PlayerObject),0
yrotate object 1,camy#
`=====Camera Controls=====
slidingcollision(oldx#,oldy#,oldz#,x#,y#,z#,3,PlayerObject,LevelObject)
if mouseclick() = 1 and FireTime < timer() - 200
gosub FireBullet
FireTime = timer()
endif
` Process the bullets that are in flight.
if BulletsInFlight > 0 then gosub bullets
inc sparkdeltimer#
text 500,20,"Spark Deletion Timer: "+str$(sparkdeltimer#)
inc cyclecount#
text 500,40,"Cycle Count: "+str$(cyclecount#)
`))$#@#!BULLET ARRAY!#@#$((
LineY = 10
for b = 0 to 10
inc LineY, 20
text 10, LineY, str$(bullets(b).ObjectNumber) + " / " + str$(bullets(b).Distance)
next b
inc LineY, 20
text 10, LineY,"Bullets in flight: "+str$(BulletsInFlight)
phy update 1
phy update 0
sync
loop
Notice how before the WASD controls I have oldx-z and after I have x-z? Then you just call them when calling the slidingcollision() function.
Oh, and to use it on terrain, just type the terrain object number for OBJ in the function... like this:
slidingcollision(oldx#,oldy#,oldz#,x#,y#,z#,3,PlayerObject,LevelObject)
That's where I called it, which is also in the loop. See, I have my old x-z, the new x-z, and then the radius of the collision sphere, then the playerobject and levelobject, which you replace with your object numbers unless you are using a system like mine.