OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: armymanbronson on 29 Aug 2002, 16:46:45
-
hey guys im doing a jet mission now i have an empty jet with a pilot in it with this moveindriver jet in his init field, i want the camera to stick with the pilot. like i know how to do basic cut scenes just want to know the command for making the camera stay with the target thats all.
cheers.
bronson
-
:)Name the pilot aP then place this line in your script;
_cam camsettarget aP
That should do it for you. aP can be any name you want. :)
-
Hi,
Not sure i understood it right, seems you want to make the camera following the pilot, right?
Personnaly, I'm using a loop for this effect. Here the code:
_cam camSetTarget MyPilot
#loop1
_cam camSetRelPos [-5,0,0]
_cam camCommit 0
@camCommitted _cam
~0.01
goto "loop1"
This will make the camera follow its target. In this exemple the cam will be 5 meters on the left of the pilot ([-5,0,0]). You may need to end this loop sometimes, so you can add a counter and an exit condition.
Hope this helps.
-
how do you add a counter? something on teh lines of
_counter = 0
#loop
? (_counter == 5) : exit
_counter = _counter + 1
~1 goto loop
is that how you make a counter?
-
yeah, something like that... but for a time counter, it should be incremented with the same value as the delay value.
_i = 0
#loop1
...
~0.01
_i = _i + 0.01
?(_i < 5) goto "loop1"
this should make the camera following its target for 5 seconds.
The cool thing with this loop is that you can create awesome effects. IE: a camera is following a plane and make a 360° tourn around on the same time:
_cam camSetTarget MyPilot
_i = 0
#loop1
_cam camSetRelPos [cos((getdir MyPilot) + _i) * 10,sin((getdir MyPilot) + _i) * 10,0]
_cam camCommit 0
@camCommitted _cam
~0.01
_i = _i + 1
(?_i < 360):goto "loop1"
in this case, the exit condition is met when the camera did a 360° turn around.
-
Even if this is more towards Script Ideas I'll post it here.
The 360° thing is not that advanced. Fairly simple, right?
Also makes for a fairly simple shot.
But, what if you add a third dimension to the 360° spin?
Like, go below/above the plane in the same pan?
A = Start
B = Mid point
C = End
D = Airplane
B
^
|
A <- D -> C
Did that make sense?
The camera starts on the right side, moves to the front and up so at B it's looking down at the cockpit from the front, then moves down to end up at C which is a point on the left side.
That shouldn't be impossible, right?
It's just that it's early right now, and I'm not that up to speed on my maths.
-
yeah, that's piece of cake, indeed.
For this effect, you need a 180° effect and a height threshold. Basically you increment z axis with say a value of 0.1 until the camera reach 90° and then decrement it with the same value:
_cam camSetTarget MyPilot
_i = 0
_z = 0
#loop1
?(_i < 90):_z = _z + 0.1
?(_i > 90): _z = _z - 0.1
_cam camSetRelPos [cos((getdir MyPilot) + _i) * 10,sin((getdir MyPilot) + _i) * 10,_z]
_cam camCommit 0
@camCommitted _cam
~0.01
_i = _i + 1
(?_i < 180):goto "loop1"
-
Thanks mate =)
I was thinking about the same thing, but my sleep deprived brain could not muster the energy to do the very simple math for that one ;D
-
np, brains need to warm up too :)
btw, there was a little logic error in my last script, it is edited and fixed.
oh, and you may have to tweak the time delay and the distance increments to have a smooth effect, i can't test it right now, but the main system does work.