Page 1 of 1

AddCameraShot() Research

Posted: Tue Jul 01, 2014 8:26 pm
by Marth8880
Hey guys. I was playing around with the AddCameraShot values earlier today and I found out some things that I thought would be convenient to post.

_____________________________________________

Function layout:

AddCameraShot(rotate_y, rotate_z, UNKNOWN, rotate_x, position_x, position_y, position_z)

The rotate values are most likely in radians (instead of degrees - i.e., the value can range from -1.0 to 1.0) and the position values are most likely individual grid units (or possibly quarters of them) in Zero Editor with the center - 0,0,0 - being the very center of the grid.


Example code with comments:

Code: Select all

	-- Information: rot_y     rot_z      unknown   rot_x       pos_x     pos_y       pos_z
	AddCameraShot(0.327342, 0.011198, -0.944287, 0.032303, -74.878967, 5.497213, -69.507790);		-- tram station
Notes regarding 'UNKNOWN':

The unknown value is...weird. Here's a snippet of a conversation regarding it (in italics) between me and AQT:
Hidden/Spoiler:
[quote]4:36 PM - [GT] Bran: What the...
4:36 PM - [GT] Bran: So it like...
4:37 PM - AQT: :o
4:37 PM - [GT] Bran: I seem to have most of the values down...
4:37 PM - [GT] Bran: But the one weird one.
4:37 PM - [GT] Bran: So far, it seems to like...
4:37 PM - [GT] Bran: Rotate diagonally sort of I guess?
4:37 PM - AQT: Ah...
4:37 PM - [GT] Bran: Via XY.
4:38 PM - [GT] Bran: Also lol
4:38 PM - [GT] Bran: The ordering of the rotation values is so freaking weird.
4:38 PM - [GT] Bran: It goes YZ unknown X.
4:38 PM - [GT] Bran: Instead of XYZ unknown or whatever.
4:39 PM - AQT: Odd.
4:39 PM - [GT] Bran: I guess it probably makes sense though.
4:39 PM - [GT] Bran: Actually yeah, it sort of does from a certain point of view.
4:39 PM - [GT] Bran: Because it's rotating the camera around said axis.
4:40 PM - [GT] Bran: So with YZX, it follows the XYZ formation in a way.
4:40 PM - [GT] Bran: Because Y rotates the camera left and right.
4:41 PM - [GT] Bran: Z rotates around the center.
4:41 PM - [GT] Bran: And then X rotates it up and down.
4:41 PM - [GT] Bran: So it only...kinda fits...ish...
4:41 PM - [GT] Bran: It's still weird though.
4:42 PM - [GT] Bran: Because when XYZ are all 0, the unknown value doesn't seem to affect anything. :0
4:42 PM - AQT: Alright.
4:42 PM - AQT: :o
4:42 PM - AQT: Creepy...
4:42 PM - [GT] Bran: Yeahzo...
4:42 PM - AQT: Maybe it makes a scary little kid pop up in your room and mess things up?
4:42 PM - [GT] Bran: HAHA
4:43 PM - [GT] Bran: Sick...
4:44 PM - AQT: Heho...
4:46 PM - [GT] Bran: So when all of the rotation values are 0 and the unknown value is 0, the camera is completely black.
4:46 PM - [GT] Bran: Even when you spawn.
4:46 PM - AQT: Spawn into darkness?
4:46 PM - [GT] Bran: Heho...
4:47 PM - [GT] Bran: I guess so...
4:47 PM - [GT] Bran: Hmm.
4:47 PM - [GT] Bran: But if you respawn, no more darkness...
4:48 PM - [GT] Bran: Probably because the camera moves to where you died.
4:48 PM - [GT] Bran: And sort of resets itself probably. :0

[/quote]

Re: AddCameraShot() Research

Posted: Tue Jul 01, 2014 9:13 pm
by GAB
Maybe the UNKNOWN value is a zoom of some sort.

Re: AddCameraShot() Research

Posted: Tue Jul 01, 2014 9:33 pm
by Marth8880
That's what AQT and I originally thought, but it seems to rotate the camera diagonally in a weird way without any sort of zoom. :?

Re: AddCameraShot() Research

Posted: Tue Jul 01, 2014 9:35 pm
by Teancum
GAB wrote:Maybe the UNKNOWN value is a zoom of some sort.
Or an FOV change?

Re: AddCameraShot() Research

Posted: Tue Jul 01, 2014 9:53 pm
by Marth8880
Teancum wrote:
GAB wrote:Maybe the UNKNOWN value is a zoom of some sort.
Or an FOV change?
Possibly, but not likely, considering the value's range seems to be -1.0 to 1.0 like with the rotation values, though one could somewhat argue that the maximum (1.0) and minimum (-1.0) field of view "final" values are hardcoded. It would be a weird thing to hardcode, though. Also, judging from my tests, the camera's actual field of view never appeared to change, but rather the rotation of the camera did instead. :?

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 8:22 am
by AnthonyBF2
you can use the debug executable and use free cam, use the command thing and type "dumpcamera" to print coordinates. they are saved in a text file in the gamedata folder.

hope this helps (sounds like you were editing the numbers manually in map script)

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 9:10 am
by AQT
anthonybf2 wrote:sounds like you were editing the numbers manually in map script
...to find out what each value does.

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 3:38 pm
by LRKfm946
You could also try changing the camera shot in real time via LUA in the debug console (SetCameraPosition, etc.). I'm not sure if any of those functions will have all the parameters you want though.

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 8:38 pm
by AceMastermind
The rotation values being displayed are likely quaternions.

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 9:38 pm
by Maveritchell
I can't find my notes on this (I used to have some of this commented on in a test script; I'll update this if I can dig it up), but an easier way to test this is going to be with CreateMatrix(), which uses the same inputs. You'll be able to examine position and rotation much easier (and externally) that way.

Re: AddCameraShot() Research

Posted: Wed Jul 02, 2014 10:07 pm
by Marth8880
AceMastermind wrote:The rotation values being displayed are likely quaternions.
That would make a lot more sense, especially considering quaternions consist of four values/dimensions (or something like that).
Maveritchell wrote:I can't find my notes on this (I used to have some of this commented on in a test script; I'll update this if I can dig it up), but an easier way to test this is going to be with CreateMatrix(), which uses the same inputs. You'll be able to examine position and rotation much easier (and externally) that way.
Notes would be great. :) I'll also try to mess around with CreateMatrix().