Home   Help Search Login Register  

Author Topic: Camera stick to the pilot  (Read 1776 times)

0 Members and 1 Guest are viewing this topic.

armymanbronson

  • Guest
Camera stick to the pilot
« 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

crow

  • Guest
Re:Camera stick to the pilot
« Reply #1 on: 29 Aug 2002, 17:53:44 »
 :)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. :)

Backoff

  • Guest
Re:Camera stick to the pilot
« Reply #2 on: 29 Aug 2002, 19:51:10 »
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.



tai mai shu

  • Guest
Re:Camera stick to the pilot
« Reply #3 on: 30 Aug 2002, 05:30:15 »
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?

Backoff

  • Guest
Re:Camera stick to the pilot
« Reply #4 on: 30 Aug 2002, 11:27:20 »
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.
« Last Edit: 30 Aug 2002, 11:56:00 by Backoff »

Offline KTottE

  • Former Staff
  • ****
Re:Camera stick to the pilot
« Reply #5 on: 30 Aug 2002, 11:41:05 »
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.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Backoff

  • Guest
Re:Camera stick to the pilot
« Reply #6 on: 30 Aug 2002, 11:52:54 »
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"
« Last Edit: 30 Aug 2002, 12:43:11 by Backoff »

Offline KTottE

  • Former Staff
  • ****
Re:Camera stick to the pilot
« Reply #7 on: 30 Aug 2002, 12:02:17 »
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
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Backoff

  • Guest
Re:Camera stick to the pilot
« Reply #8 on: 30 Aug 2002, 12:44:21 »
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.
« Last Edit: 30 Aug 2002, 12:46:05 by Backoff »