I have defined a simple VC that is intended to switch camera views between three seats in a row from left to right in a cockpit.
I have this code for
Pressing F8 puts me in the left seat (id = 0) as expected. However, CTRL+ left/right arrow does not change the camera position to positions 1 or 2.
The camera positions and directions are defined as follows:
Changing the index manually does give me the correct camera. It simply does not cycle through the camera positions using the keyboard controls.
Any idea what I am missing?
I have this code for
Code:
function clbk_loadVC(id)
if id == 0 then
vi:set_cameraoffset(camera_loc[1])
vi:set_cameradefaultdirection(camera_dir[1])
vi:set_cameramovement(_V(0,0,0.3), 0, 0, _V(-0.3,0,0), 75*RAD, -5*RAD, _V(0.3,0,0), -20*RAD, -27*RAD)
oapi.VC_set_neighbours(-1, 1, -1, -1)
elseif id == 1 then
vi:set_cameraoffset(camera_loc[2])
vi:set_cameradefaultdirection(camera_dir[2])
vi:set_cameramovement(_V(0,0,0.3), 0, 0, _V(-0.3,0,0), 75*RAD, -5*RAD, _V(0.3,0,0), -20*RAD, -27*RAD)
oapi.VC_set_neighbours(0, 2, -1, -1)
elseif id == 2 then
vi:set_cameraoffset(camera_loc[3])
vi:set_cameradefaultdirection(camera_dir[3])
vi:set_cameramovement(_V(0,0,0.3), 0, 0, _V(-0.3,0,0), 75*RAD, -5*RAD, _V(0.3,0,0), -20*RAD, -27*RAD)
oapi.VC_set_neighbours(1, -1, -1, -1)
end
end
Pressing F8 puts me in the left seat (id = 0) as expected. However, CTRL+ left/right arrow does not change the camera position to positions 1 or 2.
The camera positions and directions are defined as follows:
Code:
--Camera viewpoints
camera_loc = {}
camera_loc[1] = vec.sub({x=-0.2,y=0.3,z=1.5},cg) --pilot seat (was on left side in R-4)
camera_loc[2] = vec.sub({x= 0.0,y=0.3,z=1.5},cg) --centered seat
camera_loc[3] = vec.sub({x= 0.2,y=0.3,z=1.5},cg) --right seat
camera_dir = {}
camera_dir[1] = get_help.rotate_pitch({x=0, y=0, z=1}, -20*RAD)
camera_dir[2] = get_help.rotate_pitch({x=0, y=0, z=1}, -20*RAD)
camera_dir[3] = get_help.rotate_pitch({x=0, y=0, z=1}, -20*RAD)
Changing the index manually does give me the correct camera. It simply does not cycle through the camera positions using the keyboard controls.
Any idea what I am missing?