Yeah, the object hit and collision functions only tell you a collision has occurred. You have to code a response to the collision. I don't know if the Automatic Camera Collision function will work with a static object. But, give it a try.
hide mouse
autocam off
print "NEXT ENGINE VERSION 0.01"
WAIT 500
print "LOADING GAME..."
//Loading the map
set dir "Files"
load static objects "Maps\Map01\Universe.dbo", 0
//Set up syncing
sync on
sync rate 120
//Setting up the camera
position camera 50, 55, -50
automatic camera collision 0, 5, 0
do
move camera (upkey()-downkey())*0.25
turn camera right (rightkey()-leftkey())*0.25
sync
loop
Here is a modified version of how FPS Creator handles camera movement and collision put into a function.
global g_camspeed as float
global g_gravity as float
` Initialize global g_camspeed
g_camspeed = 3.0
` ------------------------------------------------
` Put your code here. Call CamControl in main loop
` ------------------------------------------------
end
function CamControl()
` declare local variables
` -----------------------
` Keyboard input
local keystate17 as integer
local keystate30 as integer
local keystate31 as integer
local keystate32 as integer
` Mouse input
local cammovex as float
local cammovey as float
` Old camera position
local cox as float
local coy as float
local coz as float
` New camera position
local cnx as float
local cny as float
local cnz as float
` Camera movement
local sx as float
local sy as float
local sz as float
local y as float
` Camera angle
local camangx as float
local camangy as float
` Get keyboard input
keystate17 = keystate(17)
keystate30 = keystate(30)
keystate31 = keystate(31)
keystate32 = keystate(32)
` Get mouse input
cammovex = mousemovex()
cammovey = mousemovey()
` Store camera position
cox = camera position x()
coy = camera position y()
coz = camera position z()
` Control camera movement
if keystate17 - keystate31 or keystate32 - keystate30
sx = camera angle x()
sy = camera angle y()
sz = camera angle z()
y = atanfull( keystate32 - keystate30, keystate17 - keystate31)
rotate camera 0, sy + y, sz
move camera g_camspeed
rotate camera sx, sy, sz
endif
` Set new camera position
cnx = camera position x()
cny = camera position y() - g_gravity
cnz = camera position z()
` Overall ellipse collision for camera
if static volume(cox, coy - 20, coz, cnx, cny - 20, cnz, 1.0)
cnx = cox + get static Collision x()
cny = coy + get static Collision y()
cnz = coz + get static Collision z()
g_gravity = 0.5
else
inc g_gravity, 0.5
endif
` Stop falling forever
if cny < -200.0
cny = -200.0
endif
` Update camera
position camera cnx, cny, cnz
` Control camera view
camangx = camera angle x() + cammovey / 1.5
camangy = camera angle y() + cammovex / 1.5
if wrapvalue(camangx) > 85 and wrapvalue(camangx) < 180
camangx = 85.0
endif
if wrapvalue(camangx) > 180 and wrapvalue(camangx) < 275
camangx = 275.0
endif
rotate camera camangx, camangy, camera angle z()
endfunction