Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: 0rph3u5 on July 13, 2009, 08:00:10 am

Title: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 13, 2009, 08:00:10 am
I'm currently trying to set-up a cutscene with FRED where the player is to see the patrol flight of another wing from the perspective of one of those fighters...
Patrol 3 is Herc II with initial orders to fly waypoints parallel to Patrol 1 & 2 which fly respective waypoints

EDIT: I forgot - I'm running on 3.6.10 RC2 for fs2_open.exe

First I tired it with the "set-camera-host" - event was set up just like this:
Code: [Select]
- when
   |____ ture
   |
   |____set camera host
             |___ Patrol 3
             |___ weapons
problem is that the camera is no in the center of the fighter, as if the second argument would do nothing at all ....

Am I missing something here?
Or is this just another chase for Mantis?
Or do I have to wait for 3.6.11?





ps. I tried to work around the problem the following way but it does not work either (camera is constantly shaking from the rapid repositioning; would not adjust for itself if fighter turned) - but still that was more close to the solution I wanted...
Code: [Select]
- every-time
   |____ ture
   |
   |____set camera position
             |___+
                 |_ get object x
                      |_ Patrol 3
                 |_ 2
             |___-
                 |_ get object y
                      |_ Patrol 3
                 |_ 1
             |___+
                 |_ get object z
                      |_ Patrol 3
                 |_ 2
Title: Re: Cutscene problem - set-camera-host
Post by: Colonol Dekker on July 13, 2009, 08:46:27 am
The xyz is relative to the world. I've not managed to get a camera to match perspectives with a fighter yet but i'll upload a quick mission later on when I get home from work. It might help you out.
Title: Re: Cutscene problem - set-camera-host
Post by: 0rph3u5 on July 14, 2009, 01:29:12 am
I've not managed to get a camera to match perspectives with a fighter yet

I dont want the perspective to be an exact match it should be more like this (well without being stuck in the side of the Herc):
[EDIT: now better perspective]

[EDIT2: attachments deleted]
Title: Re: Cutscene problem - set-camera-host
Post by: 0rph3u5 on July 14, 2009, 01:59:35 pm
Okay... with the help of Mobius and a lot of patience I've achived a nearly working solution....
you still see the camera reseting all the time since there are always objects in the view-field...
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Skullar on July 16, 2009, 11:56:20 am
are you updating a campaign or is this for something new ?
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 17, 2009, 04:20:20 am
Can you send me the fs2 file you are messing with ? I want to see what you are doing, and wanna give it a try myself :)

Not until the campaign is done; its for a plot-critical cutscene
Spoiler:
its so crictical I dont dare to úse these tags to talk about it

are you updating a campaign or is this for something new ?

its for "The Lost Generation" - I need to re-create some good-old FS2 moments as cutscenes to drive the story of that campaign onwards
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: portej05 on July 17, 2009, 04:44:40 am
We can't help you without sighting some of these files - it's too hard to try and figure out what you're doing.
The other way to get help is to jump on #hard-light and ask for directions from there.

EDIT: Better still, boil it down to a really simple case that folks can then work from.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 17, 2009, 04:53:25 am
this is not about some fancy FREDing operation; it is quite simple  and a description of the situation is given in post #1....

simply set up an event a la when-ture-set_camera_host etc. and see for yourselves

Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Colonol Dekker on July 17, 2009, 05:59:45 am
That'll only do it the once. You need to everytime it. Wait til later i'll post an old concept of different camera usage.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 17, 2009, 06:11:18 am
That'll only do it the once. You need to everytime it. Wait til later i'll post an old concept of different camera usage.

unless you are refering to the workaround:

As I have seen it it is quite the contrary:
set_camera_host attaches the camera to the object until the said otherwise; I had it working with a moving object but not at the right point (read post #1 damn you!), problem with that sexp is that the second argument does not appear to do anything at all the way I did this....
which leads to the camera being stuck right in the middle of the Herc here....

once I get home I'll re-enable that event and make another screenshot of it so you see what I mean.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Colonol Dekker on July 17, 2009, 06:18:00 am
Use mathematical modifiers on the x y z bits of the get object coordinates.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 17, 2009, 10:30:39 am
here come the perspective shots + the respective sexps...

Notes on picture no. 1 - the WORKAROUND:
- get-object-y/z are are the same as ...-x except the numbers in the mathematical operators are different
- the accumulation of mathematical operators comes due to the fact that FRED does not acknowledge eg. 2.5 as number in operators (though I'm not quite sure here whetever this does anything or not)
- you cannot see the camera reseting everytime

Notes on picture no. 2 - the REAL DEAL:
- the weapons sub-system of the Herc II (and as well that of the Herc II HTL) is suposed to be somewhere above the left shoulder of the pilot....

[attachment deleted by MSC
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Colonol Dekker on July 17, 2009, 03:40:16 pm
Try something like this. I've decided against uploading my mission as it uses numerous additional ships, hud effects, subtitle graphics and sound files... It's frickin sweet as an intro though....


In short, try to add a + to the right axises/axees/axiis??? and tweak through trial and erro (or just get the eye point position using PCS2.)


EDIT- "Camera off" is chained to whatever time you see fit.

[attachment deleted by MSC
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Tomo on July 18, 2009, 06:00:57 am
According to the SCP SEXP Wiki, set-camera-position works in World-Space (Mission Space), which means Dekker's solution doesn't work at all.

Turn the ship upside down, and the camera will not follow the roll - as 0rph3u5 mentioned.

FRED doesn't have matrix operators, which means that set-camera-position simply can't be used for this effect.
The FRED-only solution must be set-camera-host, but that SEXP doesn't seem to be documented in the Wiki.

An alternative solution would be to do it as a script, as that does allow you to work in model space and then transform to world-space. To be honest, that looks to be the only genuine solution at present if set-camera-host isn't working for subsystems.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Colonol Dekker on July 18, 2009, 08:36:20 am
Maybe host could use a "attach to eyepoint" thing moving forward in development.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 18, 2009, 09:05:09 am
Dekker's solution is simply the same as my workaround - I can say that without having tried yet 'cause Both are the same

I go the way

[X] + (a + b/c) = [X] + n ; n is the number returned from n = a + b/c

while he goes

0 + [X] + n = [X] + n ; n is a number

though I'm bad in maths I can say for sure that is the same equation; though mine as the advantage that the range of number is greater if FRED really acknowledges b/c to return a number other than 01) in chases c > b 2)....

-------------------------------------------------------------------------

Now to the intersting part.... I've developed another workaround I was too afraid to touch yet
BUT BE WARNED: this workaround will only work in nebula enviorment or with respective background changes and fade-in/-out...

since one can expand set-camera-postion from simply 3 arguments (simply coordinates) to 5 arguments (coordinates, movement time and acceleration time)3) one could let the camera move aside the fighter at the same speed (given you have limited the fighters speed with cap-waypoints-speed or otherwise)....
but that requires some calcuations (you have to calculate the time of movement so the camera speed will matche the fighter's speed; a matter of c = d * t-1, or the derived t = d * c-1) and it would not respond to the fighter maneuvering around (unless that is also that way scripted - if that is possible at all), would require bit more of tiral and error and would not work if the FRED does not acknowelde numbers smaller than 1 to be different from zero in events2)

1) dunno if it fixed yet but FRED has the unpleasent ability to set all numbers it does not fully reckognise to be not different 0 (as it happens to be if you tried to randomize negative numbers)
2) FRED does not reckognize non-Natural Numbers (eg 2.5) as numbers if entered normally into a number field of a sexp  - it comes up with "no a number" in such chases; hence that damn workaround in pciture 1
3) acutally its six possilbe arguments...

EDIT: here comes a test picture - mind that I just entered some random numbers (10000 & 1000) - that made the camera speed right past the Hercs and allowed that to catch up later...

[attachment deleted by MSC
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Tomo on July 19, 2009, 02:04:59 pm
Just had a quick scan through the code, and "set-camera-host" should be doing what is required.

I'm going to build a mini-mission now to see if it's working at all.

Edit:
Right, it does in fact do exactly what it says on the tin. It sets the camera to the origin of the stated sub-object, with the same orientation as the sub-object.
But... That's not actually what anybody would want, because the origin is almost always inside said sub-object.

So, it needs more data - it needs an offset in sub-object coordinates (X,Y,Z), so you can (for example) put the camera next to a turret and not have it always be physically inside.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: Angelus on July 19, 2009, 02:59:55 pm
What about editing the eyepoint of an ship, to the desired location and add the ship via .tbm, and adjust fov?
That's how i created some of the "gun-cam" views in my BtrL mission.

Yeah, it's not the most elegant approach, but it saves time and you avoid the agonizing headache that comes after working for hours/ days on a thing that refuses to work properly.
Title: Re: Cutscene problem - attaching the camera to a fighter
Post by: 0rph3u5 on July 30, 2009, 10:58:52 am
I'm going to Mantis the probelm with set-camera-host now....

I'm still open for more alternative solutions BTW

What about editing the eyepoint of an ship, to the desired location and add the ship via .tbm, and adjust fov?
That's how i created some of the "gun-cam" views in my BtrL mission.

Yeah, it's not the most elegant approach, but it saves time and you avoid the agonizing headache that comes after working for hours/ days on a thing that refuses to work properly.

possible but work intensive - I'll keep it in mind if everything fails