Always glad to help when i can. I have ran into this before long ago. Odd indeed about the walls changing
. Try this code with the new level. I'll tweak it a bit more before going to bed.
`Main Source File
sync on : sync rate 0
autocam off : hide mouse
set camera range .1, 5000
Global EyeHeight as integer
EyeHeight = 32
load object "test sewer.x", 1
set object collision to polygons 1
`create our camera collider
global cam_obj as integer
cam_obj = 2
make object sphere cam_obj, EyeHeight/2
set object collision on cam_obj
hide object cam_obj
`place the camera
position camera 0, 0, EyeHeight, 0
`place the collider object around the camera
position object cam_obj, 0, EyeHeight, 0
set ambient light 100
MainLoop:
do
CheckCollision()
if SpaceKey() = 1
`reset the camera to the start position
`so that you can get out of being trapped
position camera 0, 0, EyeHeight, 0
position object cam_obj, 0, EyeHeight, 0
EndIf
sync
loop
End
Function CheckCollision()
`record the current camera position before the move
ox#=object position x(cam_obj)
oy#=object position y(cam_obj)
oz#=object position z(cam_obj)
`accept the user's input
`Control camera using arrowkeys 0, 1, .5
`mouselook
rotate object cam_obj, object angle x(cam_obj)+(mousemovey()/2),object angle y(cam_obj)+(mousemovex()/2),0
if object angle x(cam_obj)>90 then xrotate object cam_obj,90
if object angle x(cam_obj)<-90 then xrotate object cam_obj,-90
cx#=object angle x(cam_obj) : cy#=object angle y(cam_obj) : cz#=object angle z(cam_obj)
rotate camera cx#, cy#, cz#
rotate object cam_obj, cx#, cy#, cz#
circle screen width()/2,screen height()/2,8
`movement
if upkey()=1 then xrotate object cam_obj,0 : move object cam_obj,5 : xrotate object cam_obj,cx#
if downkey()=1 then xrotate object cam_obj,0 : move object cam_obj,-5 : xrotate object cam_obj,cx#
if leftkey()=1 then xrotate object cam_obj,0 :yrotate object cam_obj,cy#-90 : move object cam_obj,5 : yrotate object cam_obj,cy#: xrotate object cam_obj,cx#
if rightkey()=1 then xrotate object cam_obj,0 :yrotate object cam_obj,cy#-90 : move object cam_obj,-5 : yrotate object cam_obj,cy#: xrotate object cam_obj,cx#
`record the new camera position
nx#=object position x(cam_obj)
nz#=object position z(cam_obj)
`retrieve the floor height at nx#, nz#
ny#=EyeHeight + (oy#-intersect object(1, nx#, oy#, nz#, nx#, -1000, nz#))
`To fix the south/north wall problem (presumably a DBP collision bug or I am
`just too sleepy to see the error)
`check to see if the distance to collision is less than half the object's
`size and if it is then nx# = ox#
newxsouth# = intersect object(1,nx#,ny#,nz#,nx#+(EyeHeight/2),ny#,nz#)
if newxsouth# > object size x(2)/2
nx# = ox#
endif
`To fix the east/west wall problem (presumably a DBP collision bug or I am
`just too sleepy to see the error)
`check to see if the distance to collision is less than half the object's
`size and if it is then nx# = ox#
newxwest# = intersect object(1,nx#,ny#,nz#,nx#,ny#,nz#+(EyeHeight/2))
if newxwest# > object size z(2)/2
nz# = oz#
endif
`move our collider to the new position
position object cam_obj, nx#, ny#, nz#
if object collision(cam_obj,0) <> 0
`try using the old y position to get rid of collision
`if not then check x and z
position object cam_obj, nx#, oy#, nz#
if object collision(cam_obj, 0)<>0
`placing our collider in the new camera position has
`caused a collision, so, we'll deal with that
`first we'll move the object back to the old
`X position and see if we still have a collision
Position object cam_obj, ox#, ny#, nz#
If Object Collision(cam_obj, 0)<>0
`moving the object to the old X position still creates a
`collision condition, so we'll see if we can at least
`get the X portion of the move and loose the Z portion
Position Object cam_obj, nx#, ny#, oz#
If Object Collision(cam_obj, 0)<>0
`this move creates a collision in both the X & Z axis
`so we'll disallow all of it
ny#=oy#
nx#=ox#
nz#=oz#
Else
`we can give the player the X portion of their move but not
`the Z portion `
nz#=oz#
EndIf
Else
`returning the object to its old X position creates a valid
`move, so we'll give the player the Z portion of their move
`alone.
nx#=ox#
EndIf
else
ny# = oy#
endif
EndIf
`move the camera to the final adjudicated position
Position Camera 0, nx#, ny#, nz#
Position Object cam_obj, nx#, ny#, nz#
set cursor 0, 0
print screen fps(),", ", object size x(2)/2,", ",oy#
EndFunction
[edit] Better version
`Main Source File
sync on : sync rate 0
autocam off : hide mouse
set camera range .1, 5000
Global EyeHeight as integer
EyeHeight = 32
load object "test sewer.x", 1
set object collision to polygons 1
`create our camera collider
global cam_obj as integer
cam_obj = 2
make object sphere cam_obj, EyeHeight/2
set object collision on cam_obj
hide object cam_obj
`place the camera
position camera 0, 0, EyeHeight, 0
`place the collider object around the camera
position object cam_obj, 0, EyeHeight, 0
set ambient light 100
MainLoop:
do
CheckCollision()
if SpaceKey() = 1
`reset the camera to the start position
`so that you can get out of being trapped
position camera 0, 0, EyeHeight, 0
position object cam_obj, 0, EyeHeight, 0
EndIf
sync
loop
End
Function CheckCollision()
`record the current camera position before the move
ox#=object position x(cam_obj)
oy#=object position y(cam_obj)
oz#=object position z(cam_obj)
`accept the user's input
`Control camera using arrowkeys 0, 1, .5
`mouselook
rotate object cam_obj, object angle x(cam_obj)+(mousemovey()/2),object angle y(cam_obj)+(mousemovex()/2),0
if object angle x(cam_obj)>90 then xrotate object cam_obj,90
if object angle x(cam_obj)<-90 then xrotate object cam_obj,-90
cx#=object angle x(cam_obj) : cy#=object angle y(cam_obj) : cz#=object angle z(cam_obj)
rotate camera cx#, cy#, cz#
rotate object cam_obj, cx#, cy#, cz#
circle screen width()/2,screen height()/2,8
`movement
if upkey()=1 then xrotate object cam_obj,0 : move object cam_obj,5 : xrotate object cam_obj,cx#
if downkey()=1 then xrotate object cam_obj,0 : move object cam_obj,-5 : xrotate object cam_obj,cx#
if leftkey()=1 then xrotate object cam_obj,0 :yrotate object cam_obj,cy#-90 : move object cam_obj,5 : yrotate object cam_obj,cy#: xrotate object cam_obj,cx#
if rightkey()=1 then xrotate object cam_obj,0 :yrotate object cam_obj,cy#-90 : move object cam_obj,-5 : yrotate object cam_obj,cy#: xrotate object cam_obj,cx#
`record the new camera position
nx#=object position x(cam_obj)
nz#=object position z(cam_obj)
`retrieve the floor height at nx#, nz#
ny#=EyeHeight + (oy#-intersect object(1, nx#, oy#, nz#, nx#, -1000, nz#))
`To fix the south/north wall problem (presumably a DBP collision bug or I am
`just too sleepy to see the error)
`check to see if the distance to collision is less than half the object's
`size and if it is then nx# = ox#
newxsouth# = intersect object(1,nx#-(EyeHeight/2),ny#,nz#,nx#+(EyeHeight/2),ny#,nz#)
if newxsouth# > 0
if newxsouth# > ((object size x(2)/2)*3) or newxsouth# < object size x(2)/2
nx# = ox#
endif
endif
`To fix the east/west wall problem (presumably a DBP collision bug or I am
`just too sleepy to see the error)
`check to see if the distance to collision is less than half the object's
`size and if it is then nx# = ox#
newzwest# = intersect object(1,nx#,ny#,nz#-(EyeHeight/2),nx#,ny#,nz#+(EyeHeight/2))
if newzwest# > 0
if newzwest# > ((object size z(2)/2)*3) or newzwest# < object size x(2)/2
nz# = oz#
endif
endif
`move our collider to the new position
position object cam_obj, nx#, ny#, nz#
if object collision(cam_obj,0) <> 0
`try using the old y position to get rid of collision
`if not then check x and z
position object cam_obj, nx#, oy#, nz#
if object collision(cam_obj, 0)<>0
`placing our collider in the new camera position has
`caused a collision, so, we'll deal with that
`first we'll move the object back to the old
`X position and see if we still have a collision
Position object cam_obj, ox#, ny#, nz#
If Object Collision(cam_obj, 0)<>0
`moving the object to the old X position still creates a
`collision condition, so we'll see if we can at least
`get the X portion of the move and loose the Z portion
Position Object cam_obj, nx#, ny#, oz#
If Object Collision(cam_obj, 0)<>0
`this move creates a collision in both the X & Z axis
`so we'll disallow all of it
ny#=oy#
nx#=ox#
nz#=oz#
Else
`we can give the player the X portion of their move but not
`the Z portion `
nz#=oz#
EndIf
Else
`returning the object to its old X position creates a valid
`move, so we'll give the player the Z portion of their move
`alone.
nx#=ox#
EndIf
else
ny# = oy#
endif
EndIf
`move the camera to the final adjudicated position
Position Camera 0, nx#, ny#, nz#
Position Object cam_obj, nx#, ny#, nz#
set cursor 0, 0
print screen fps(),", ", object size x(2)/2,", ",oy#
EndFunction
[edit2] Also a little hint on that level. If you made it in CSHOP you will definitely want to convert over to using APEX's .CSM loader. It breaks it up into limbs so it auto hides a lot of unseen polys.