Hmm. I guess Im missing somthing simple, but non the less, I cant figure this out. I have a basic FPS camera set up. but if you get to close to objects, the camera can see through parts of them. Ive attached a pic of the issue.
And here is the whole code. Its using dark physics btw...
REM Project: FPS
REM Created: 7/4/2008 11:09:03 PM
REM
REM ***** Main Source File *****
REM
sync on
sync rate 100
hide mouse
autocam off
make camera 1
color backdrop 1,rgb(10,2,2)
`load image "concrete_T.BMP",1,1
load image "f_a_01_D.dds",1,1
global zstep# as float
global zstepchange# as float
global sprintstepchange# as float
global croughstepchange# as float
global key as float
global key2 as float
global playeranglex as float
global playerangley as float
phy start
make object box 1,100,1,100
texture object 1,1
scale object texture 1,10,10
phy make rigid body static box 1
make object sphere 2,3
phy make box character controller 2, 0, 10, 0, 1, 2, 1, 1, 1.5, 45.0
o=3
make object box o,1,5,1
position object o,0,2.5,10
phy make rigid body dynamic box o
zstepchange#=.5
sprintstepchange#=.89
croughstepchange#=.2
walkstepchange#=.5
do
keymovement(plrspeed)
if mouseclick()=1
inc aspect#,.01
endif
if mouseclick()=2
dec aspect#,.01
endif
set camera aspect 1,aspect#
phy update
sync
loop
Function keymovement(plrspeed)
playeranglex=playeranglex+mousemovey()
playerangley=playerangley+mousemovex()
rotate object 2,playeranglex,playerangley,0
plrspeed=6
height=2
if shiftkey()=1
plrspeed=9
endif
if controlkey()=1
plrspeed=2
height=height/2
endif
if shiftkey()=0
key=0
endif
if controlkey()=0
key2=0
endif
if keystate(17)=1
if shiftkey()=1
zstepmax#=10
if key=0
zstepchange#=sprintstepchange#
key=1
endif
endif
if controlkey()=1
zstepmax#=5
if key2=0
zstepchange#=croughstepchange#
key2=1
endif
endif
phy move character controller 2,plrspeed
endif
if keystate(31)=1
if shiftkey()=1
zstepmax#=10
if key=0
zstepchange#=sprintstepchange#
key=1
endif
endif
if controlkey()=1
zstepmax#=5
if key2=0
zstepchange#=croughstepchange#
key2=1
endif
endif
phy move character controller 2,plrspeed*-1
endif
if keystate(30)=1
if shiftkey()=1
zstepmax#=10
if key=0
zstepchange#=sprintstepchange#
key=1
endif
endif
if controlkey()=1
zstepmax#=5
if key2=0
zstepchange#=croughstepchange#
key2=1
endif
endif
rotate object 2,object angle x(2),object angle y(2)-90,0
phy move character controller 2,plrspeed
endif
if keystate(32)=1
if shiftkey()=1
zstepmax#=10
if key=0
zstepchange#=sprintstepchange#
key=1
endif
endif
if controlkey()=1
zstepmax#=5
if key2=0
zstepchange#=croughstepchange#
key2=1
endif
endif
rotate object 2,object angle x(2),object angle y(2)+90,0
phy move character controller 2,plrspeed
endif
if zstepmax#>0
dec zstepmax#,1
else
zstep#=0
endif
if zstepmax#>0
zstep#=zstep#+zstepchange#
if zstep#>=zstepmax#
zstepchange#=zstepchange#*-1
endif
if zstep#<=zstepmax#*-1
zstepchange#=zstepchange#*-1
endif
endif
phy move character controller 2,0
rotate object 2,playeranglex,playerangley,0
position camera 1,object position x(2),object position y(2)+height,object position z(2)
rotate camera 1,object angle x(2),object angle y(2),object angle z(2)
roll camera right 1,zstep#
endfunction
Is the answer to just not let the player get to close to objects?