Hi, I'm working on logiccam 2.0 early beta , I've added the ability to pan the camera to an other relative position while the camera is following a moving vehicle.
It still does the job like in logiccam1.0 but this time you can use the normal camsetrelpos values
This means you can start the camera behind a moving truck, then the camera catches up and ends in the cargoroom.
It works but it's hard to control the steps the cam has to move each loop.
In theory,...when I want the camera to move 5m up high in 20 seconds, thats 25cm per second, in a loop with a 0.001s delay that make 0.025m each loop.
But that's theory...
In camsetrelpos therms that's from [0,0,0] to [0,0,5]
On a moving truck the camera stops at aprox 6m high, 1 m too high.
When I use it on a static vehicle the camera moves up to 10m or higher, much to far.
Why is that? It seems to be affected by the vehicle's speed or is my script not fast enough?
Anyway, here is the script :
;________________________
;::::::::::::::::::::::::
;
;Logiccam2.0
;author <Blanco>
;created 25/06/2005 5:07:54
;________________________
;::::::::::::::::::::::::
_camid = _this select 0
_veh = _this select 1
_campos = _this select 2
_targetpos = _this select 3
_zoom = _this select 4
_dur = _this select 5
_offset = _this select 6
_offset2 = _this select 7
startglcam = true
_cx = _campos select 0
_cy = _campos select 1
_cz = _campos select 2
_tx = _targetpos select 0
_ty = _targetpos select 1
_tz = _targetpos select 2
_fx = _offset select 0
_fy = _offset select 1
_fz = _offset select 2
_ox = _offset2 select 0
_oy = _offset2 select 1
_oz = _offset2 select 2
_q = _dur * (_dur*1.5)
_stepx = _fx / _q
_stepy = _fy / _q
_stepz = _fz / _q
_stepx2 = _ox / _q
_stepy2 = _oy / _q
_stepz2 = _oz / _q
_cgl = "logic" camcreate [0,0,0]
_tgl = "logic" camcreate [0,0,0]
#loop
?!startglcam : goto "endcam"
_cx = _cx + _stepx
_cy = _cy + _stepy
_cz = _cz + _stepz
_tx = _tx + _stepx2
_ty = _ty + _stepy2
_tz = _tz + _stepz2
;player globalchat format ["Rel. Cpl [%1 ,%2 ,%3] Rel. Tpl [%4 ,%5 ,%6] %7",_cx,_cy,_cz,_tx,_ty,_tz]
_objx=getpos _veh select 0;
_objy=getpos _veh select 1;
_ang = getdir _veh
_posx=(_cx*cos _ang)+(_cy*sin _ang)+_objx
_posy=(_cy*cos _ang)-(_cx*sin _ang)+_objy
_posx2=(_tx*cos _ang)+(_ty*sin _ang)+_objx
_posy2=(_ty*cos _ang)-(_tx*sin _ang)+_objy
_glpos1=[_posx,_posy,_cz]
_glpos2=[_posx2,_posy2,_tz]
_cgl setpos _glpos1
_tgl setpos _glpos2
_camid camsetpos getpos _cgl
_camid camsettarget _tgl
_camid camsetfov _zoom
_camid camcommit 0
~0.001
?_time < _dur : goto "loop"
#endcam
startglcam = false
@!startglcam
deletevehicle _cgl;deletevehicle _tgl
exit
PARAMS
______
1- Cameraname
2- Name of the vehicle you want to follow
3- Array with the camsetrelpos values for the gamelogic used for the cameraposition. (I've named it camposlogic in logiccam1.0)
4- Array with the camsetrelpos values for the gamelogic used for the cameratarget. ( Camtargetlogic named in Logiccam1.0)
5- Zoomfactor, same value as Camsetfov
6- Duration, how long will the script run?
7- array offset camposlogic
8- Array offset Camtargetlogic
Full example :
[_camera,car,[0,-15,2.5],[0,10,2.5],0.7,20,[0,15,0],[0,0,0]] exec "logiccam2.sqs"
This camera will start 15 meters behind the vehicle, camera pointed to a spot 10m in front the vehicle and 2.5m high.
Then the camera should move 15m forward within 20seconds, like I said, it's not precise it more like 15,5 - 16m
Spoken in camsetrelpos therms :
When your logic starts at [0,-15,2.5] and you offset is [0,15,0], the logic should stop moving at [0,0,2.5]
Other example :
When logic starts at [3,5,0.5], and offset is [-5,2,3], logic should stop at [-2,7,3.5]
You can make complex cutscenes with this, the only thing that should be improved is the accuracy.
Testdemo is coming soon.
*edit*
Damn, I've found a bug when using the script on planes and such... :-\
I'm sure this is do-able...but I have a bad feeling that I'm still far from the solution