Hi everybody,
My friend and I are creating a video game for a project in school, and we have made our level and everything. We are having an issue with making our camera (and eventually object) collide with our world made in 3D World Studio.
This is our code currently:
set display mode 1280, 800, 32
Sync On
Sync Rate 100
Set Dir "Media"
Load Object "norse.dbo", 1
Set object transparency 1,1
Color backdrop FFFFFF
Position object 1,0,0,0
Position camera 51,51,51
Backdrop on
set camera range 1,10000
`sc_setupComplexObject 1,1,3
do
Text 10,10,"FPS: " + str$(screen fps())
Text 10,30,"Polygons: " + str$(statistic(1))
gosub GetUserInput
sync
collide=sc_raycast(1,oldx#,oldy#,oldz#,x#,y#,z#,0)
if collide<>0
newx#=sc_getStaticCollisionX()
newy#=sc_getStaticCollisionY()
newz#=sc_getStaticCollisionZ()
normx#=sc_getCollisionNormalX()
normy#=sc_getCollisionNormalY()
normz#=sc_getCollisionNormalZ()
position object counter,newx#+normx#/100.0,newy#+normy#/100.0,newz#+normz#/100.0
point object counter,newx#+normx#,newy#+normy#,newz#+normz#
show object counter
inc counter
if counter>10080 then counter=10002
endif
loop
Getuserinput:
rotate camera camera angle x()+(mousemovey()/2),camera angle y()+(mousemovex()/2),0
if camera angle x()>90 then xrotate camera 90
if camera angle x()<-90 then xrotate camera -90
cx#=camera angle x() : cy#=camera angle y() : cz#=camera angle z()
if upkey()=1
move camera 3
endif
if downkey()=1
move camera -3
endif
if rightkey()=1
xrotate camera 0: yrotate camera cy# + 90: move camera 3: xrotate camera cx#: yrotate camera cy#
endif
if leftkey()=1
xrotate camera 0: yrotate camera cy# - 90: move camera 3: xrotate camera cx#: yrotate camera cy#
endif
if keystate(17)=1
move camera 3
endif
if keystate(31)=1
move camera -3
endif
if keystate(30)=1
xrotate camera 0: yrotate camera cy# - 90: move camera 3: xrotate camera cx#: yrotate camera cy#
endif
if keystate(32)=1
xrotate camera 0: yrotate camera cy# + 90: move camera 3: xrotate camera cx#: yrotate camera cy#
endif
return
Whenever we try to compile it, dbpro compiler gives us an error and closes. When i comment out the line sc_setupcomplexobject 1,1,3 the program runs, but with no collision. What am I doing wrong?