are you just trying to set the camera perspective to that of 1 of a few characters? if so, i would avoid creating (and deleting) multiple cameras as you are here unless you plan on utilizing multiple views
at the same time because it will cause
massive performance hits. it doesn't appear that you're using more than one at a time so why not just move and set up the same camera based on the current character?
is this what you're wanting to do? (check this code)
set display mode 1024,768,32
sync on : sync rate 0 : autocam off
color backdrop 0 : hide mouse
randomize timer()
char1 = 1 `character 1
char2 = 2 `character 2
make object sphere char1, 20.0
color object char1, rgb(255,0,0)
position object char1, 500.0,0.0,500.0
make object sphere char2, 20.0
color object char2, rgb(0,255,0)
position object char2, 550.0,0.0,450.0
make matrix 1,1000.0,1000.0,50,50
randomize matrix 1, 20.0
update matrix 1
rem some initialization
onchar = char1 `set char 1 as the "on" or currently active character
offchar = char2 `set char 2 as the "off" character
ink rgb(255,0,0),0
lastchange = timer()
mover# = 20.0
do
rem use spacekey to toggle between characters
if spacekey() = 1 and lastchange + 1000 < timer()
if onchar = char1
onchar = char2
offchar = char1
ink rgb(0,255,0),0
else
onchar = char1
offchar = char2
ink rgb(255,0,0),0
endif
lastchange = timer()
endif
gosub _playermove:
gosub _setcam:
gosub _screenstuff:
sync
loop
_playermove:
cmove# = ((timer() - lastmove)/1000.0)*mover#
if shiftkey() then cmove# = cmove# * 3.0 `shiftkey = run mode
if rightkey()
yrotate object onchar, wrapvalue(object angle y(onchar) + cmove#)
endif
if leftkey()
yrotate object onchar, wrapvalue(object angle y(onchar) - cmove#)
endif
if upkey()
move object onchar, cmove#
endif
if downkey()
move object onchar, (cmove# * -1.0)
endif
onx# = object position x(onchar)
onz# = object position z(onchar)
ony# = get ground height (1,onx#, onz#) + 10.0
onxA# = wrapvalue(object angle x(onchar))
onyA# = wrapvalue(object angle y(onchar))
onzA# = wrapvalue(object angle z(onchar))
offx# = object position x(offchar)
offz# = object position z(offchar)
offy# = get ground height (1,offx#, offz#) + 10.0
position object onchar, onx#, ony#, onz#
position object offchar, offx#, offy#, offz#
lastmove = timer()
return
_setcam:
rem position and rotate camera @ current character
position camera onx#, ony#, onz#
rotate camera onxA#, onyA#, onzA#
rem tilt and move the cam back a bit
xrotate camera 30.0
move camera -200.0
return
_screenstuff:
set cursor 0,0
print "active character: ", onchar
print "FPS: ",screen fps()
print
print "move with arrow keys"
print "<shift> = run mode"
print "press <space> to toggle between characters"
return
Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP