Home   Help Search Login Register  

Author Topic: This is complicated!  (Read 517 times)

0 Members and 1 Guest are viewing this topic.

Ex-RoNiN

  • Guest
This is complicated!
« on: 13 Feb 2003, 03:08:26 »
Ok, this is complicated.

First, I want a camera to watch two characters (call them hero1 and hero2, say) whilst they are talking and are having a dialogue. An ideal camera position would be Left-Front-Top.

Now, half-way through the dialogue, I fade out and fade in to a different location, but with the same characters. During the fades, I do a "setpos getpos gamelogic" to move them.

Ok, here is the question/what I need:

1) The camera to watch hero1 and hero2
2) The camera must move together with hero1 and hero2 in the fade sequence
3) After the setpos, hero1 and hero2 should still be facing each other, 'cos right now they ain't

How do I do this  ??? :-\ >:(

Pope_Zog

  • Guest
Re:This is complicated!
« Reply #1 on: 13 Feb 2003, 12:16:44 »
The following script will set the camera to a spot perpendicular to the centre of the line between the two men. I.e. :

 H1-----------H2
        |
        |
        |
      Camera

Code: [Select]
; Make the two men face one another.
hero2 setDir (360 - getDir hero1)
hero1 doWatch hero2
hero2 doWatch hero1

; Calculate the position between the two men.
_pos = [0.0, 0.0, 1.50]

_x = ((getPos hero1 select 0) - (getPos hero2 select 0)) / 2
_pos set [0, (getPos hero1 select 0) - _x]

_y = ((getPos hero1 select 1) - (getPos hero2 select 1)) / 2
_pos set [1, (getPos hero1 select 1) - _y]

; Calculate the distance between the two men.
_distance = hero1 distance hero2

_camera = "camera" camCreate _pos
_camera cameraEffect ["Internal", "BACK"]
_camera camSetTarget _pos
_camera camSetRelPos [(4.0 * _distance * _y), (4.0 * _distance * _x * -1), 0]
_camera camSetFov 0.40
_camera camCommit 0
@camCommitted _camera

~15

player switchCamera "INTERNAL"
player cameraEffect ["Terminate", "BACK"]
camDestroy _camera

This takes care of point 1).

For points 2) and 3) move your characters and run the script again (or copy-paste it again further down. It uses positions relative to your two heroes so the camera will follow after they have been moved.

Pope Zog