Really not understanding camera angles.


Balshor

 

Posted

I've looked at several of the guides posted, and I've been able to make an absolutely perfectly timed short demo (10 seconds, just to play with this).

I'm just having some difficulty understanding the camera system and how to manipulate it.

I have one character positioned at:
POS 74.0625 6.015625 247.640625
PYR 0 3.092506 0

I have another character positioned at:
POS 70.15625 5.6875 245.640625
PYR 0 1.619884 0

And my cameraman is initially positioned at:
CAM POS 78.639275 10.694046 237.711502
CAM PYR 0.372 2.452646 -0

I want to set up two shots. One wide one with both characters visible (which the current camera position does do), and a second with a close up shot of the second character.

First thing's first: I want to move the initial camera position about "2-3" feet closer and move it slightly to the "right." I can't seem to figure out what needs to change to do that.

Second thing I want to do is figure out a shot at chest level of character 2, about two feet away from him.

Like I said, I've fiddled with the numbers and referenced the guides and I can't quite get it right. Either my camera winds up in the floor, facing the wrong way, or is just... off.

Halp!


[IMG]http://i7.photobucket.com/albums/y263/parker_daoc/CoH/layoutcopy.png[/IMG]
[url=http://justicecorps.guildportal.com/Guild.aspx?GuildID=337077&TabID=2821537]Justice Corps[/url] on Virtue Server! ... @Strongwall

 

Posted

How comfortable are you with trigonometry?


 

Posted

...Terrible.

Why do I get the feeling this is leading up to something?


[IMG]http://i7.photobucket.com/albums/y263/parker_daoc/CoH/layoutcopy.png[/IMG]
[url=http://justicecorps.guildportal.com/Guild.aspx?GuildID=337077&TabID=2821537]Justice Corps[/url] on Virtue Server! ... @Strongwall

 

Posted

I've been curious about the formula for the camera. I see everyone talking about trig i just dont know what i'm doing. (oh and i just finished my semester of trig but formulas have slipped my mind)


"while some people would say fish, cow, ambush!"-Ice9

 

Posted

Well, I'll try to avoid getting into the trig too much.

POS stands for position. In CoH, we often call the coordinates XZY, because the first coordinate corresponds to east->west, the second to down->up, and the third to north->south. The arrows here tell you what direction you'll move if you increase one of the coordinates. If you increase the first coordinate, you'll move west. If you increase the second coordinate, you'll move up. If you increase the last coordinate, you'll move south. (As a quick way to remember these, they all go in alphabetical order: EW, DU, NS.) The units appear to be in feet, but the scale in the game isn't terribly consistent.

So, the line in the demo

POS 74.0625 6.015625 247.640625

refers to a position about 74 feet west , 6 feet above , and 248 feet south of the origin.

PYR stands for "Pitch, Yaw, Roll". The first tells the camera (or anything else) what elevation to point at (to look up or down), the second tells the camera what compass direction to point in (to look left or right), and the last tells the camera how much to tilt the view (so you can look at them sideways, for example). In practice, you usually won't see anything but a zero for roll in CoH.

The units used are radians, which are a way of measuring angles similar to degrees; they're more natural to use in many settings with angles, but they're a bit less intuitive than degrees. There are 2*Pi radians in a full circle, and most PYR angles will have a value between -Pi and Pi. (Remember, Pi is approximately 3.14.)

Pitch and Roll numbers are pretty simple...as you increase pitch, your camera will aim up. Decreasing will do the opposite. For roll, it's easiest to just keep it at zero, but increasing or decreasing it will cause the camera to tilt to the left or right without changing the direction it points in.

Yaw is complicated, mostly because it works differently for the camera and for everything else. For everything but the camera, 0 yaw points south. For the camera, 0 yaw points north. In both cases, increasing yaw turns to the right, and decreasing yaw turns to the left. (Again, LR is alphabetical.)

So, the line in the demo

CAM PYR 0.372 2.452646 -0

means point the camera .372 radians up (about 21 degrees), 2.45 radians to the right of north (which is 140 degrees, so you'll end up facing 40 degrees east of south) and not to tilt the camera at all.

Okay, so that explains what all the numbers mean. How do you move the camera closer to Actor2?

Well, we need to look at the positions of Actor2 and the camera. Subtract their corresponding coordinates (always take the direction you want to travel minus the location you start with):
<font class="small">Code:[/color]<hr /><pre>
70.15625 5.6875 245.640625 (Actor2)
78.639275 10.694046 237.711502 (Camera)

-8.483025 -5.006546 7.929123 (Difference)
</pre><hr />
The difference is the direction vector that you want to move in. There are some ways to figure out an exact distance (travel 3 feet in this direction), but for a quick estimate, you can just multiply all the numbers by the fraction of the distance you want to move from point A to point B.

For example, if you want the camera to be half as far in the close shot as the long shot, just multiply all those numbers by 1/2 to get:
<font class="small">Code:[/color]<hr /><pre>
-4.2415125 -2.503273 3.9645615
</pre><hr />
Add these numbers to the camera's starting location, and you'll get the new POS command
<font class="small">Code:[/color]<hr /><pre>
POS 74.3977625 8.190773 241.6760635
</pre><hr />

Now for the hard part: figuring out the PYR command. You need the camera's location and you have the location that you want to point at. We just computed the camera's location. The tricky thing about the place you want to point is that POS coordinates usually refer to the place something is standing. To point at the chest, you need to point at a location a bit higher than the actual POS of Actor2. If we assume that Actor2 is six feet tall, the chest will be about four feet above the POS location, so just add 4 to the middle coordinate to get the place we want to aim. Again, take the place you want to aim and subtract the position of the camera:
<font class="small">Code:[/color]<hr /><pre>
70.15625 9.6875 245.640625 (target)
74.3977625 8.190773 241.6760635 (camera)

-4.2415125 1.496727 3.9645615 (difference)
</pre><hr />

Since you're a bit uncertain about your trigonometry, I'm just going to throw the formulas out there for you. The variables X, Z, and Y are the three coordinates in the difference above.

Pitch = arctan( Z/sqrt(X^2+Y^2) )

If Y&lt;0, use
Yaw = arctan( Y/X )

If Y&gt;0, use
Yaw = arctan( Y/X ) +/- 3.14

(If X is zero, your YAW is either 0, if Y is negative, or 3.14, if Y is positive. For +/-, pick the opposite of whatever the opposite sign of the arctangent. In other words, add to a negative number, subtract from a positive one. "arctan" is the inverse tangent, which may be written "tan^-1" on your calculator.)

I'm only about 80% sure that these formulas are correct. I figured them out once over a year ago and promptly programed them into an editor so I'd never need to do so again.


 

Posted

how about a quick easy way until you get the hang of manipulating the actual CAM coordinates? Go to your postion for the chest close up and place your logged in toon there. Swing the camera around to face your toon and move in toward your face until it looks the distance away that you want. Do your demorecord. Go into the demo and decrease the 2nd set of numbers which will move the camera down from your face to your chest. It would probably be less than 1 whole number since it isn't far from your face to the chest. (Example... in 12.456 35.890 -23.890, you would make the 2nd set of #'s 35.490 and keep moving down until you got it) NOTE: for me, it is easier to go in and film from the camera angle I want and then just copy those CAM coordinates over to my demo I want it in. I have learned to manipulate the CAM but it takes time sometimes to get it just where I want by "guessing" the numbers in and changing the PYR to get it just right when I can just log in game and go to first person and get the pos/angle I want and copy it over but that is for "simple" shots. Its harder when you need the camera where you can get your in-game camera to go but for your purposes, this method might be easier.

Edit: what Balshor said above


-Listen to my Light!
-MA #1065 "Star Struck"

 

Posted

[ QUOTE ]

Pitch = arctan( Z/sqrt(X^2+Y^2) )

If Y&lt;0, use
Yaw = arctan( Y/X )

If Y&gt;0, use
Yaw = arctan( Y/X ) +/- 3.14

(If X is zero, your YAW is either 0, if Y is negative, or 3.14, if Y is positive. For +/-, pick the opposite of whatever the opposite sign of the arctangent. In other words, add to a negative number, subtract from a positive one. "arctan" is the inverse tangent, which may be written "tan^-1" on your calculator.)


[/ QUOTE ]



&lt;flashback&gt;



&lt;eyes roll back&gt;

&lt;faints&gt;

(I knew there was a reason I didn't go into a field that required extensive math skills.)


Test Subject 42 - lvl 50 Sp/DA Scrapper
Oku No Te - lvl 50 MA/SR Scrapper
Borg Master - lvl 24 Bots/traps MM
Pinnacle

Nyghtfyre - lvl 50 DM/SR Scrapper
Champion

 

Posted

[ QUOTE ]
I've been curious about the formula for the camera. I see everyone talking about trig i just dont know what i'm doing. (oh and i just finished my semester of trig but formulas have slipped my mind)

[/ QUOTE ]
That's what your trig BOOK is for.

Actually, it's possible to do this sans trig but it takes patience. Just fiddle with the numbers - but do it in an organized way. Until you get a feel for what you are doing, never change more than one number and don't change it very much.

First go in and change ONE of the position numbers by moving it up or down ONE unit. (A unit is about a foot, I think.) Play the demo back again and see how it changed. If it went the wrong way, change it in the other direction and try again. Just keep that up, a few feet at a time, until you get to the right place.

Then fiddle with the facing of the camera (PYR). Yaw is probably the most important one as it controls the direction (turning your head left or right changes your yaw). Thing is, with PYR, the numbers are more touchy. Increasing by 1 will turn you a LOT. So just move the number up or down by 0.1 instead - maybe even 0.05. Then do the first number (the pitch - nodding your head down or up is changing your pitch). It likely won't need much changing. The final number is the roll (turning your head ON it's side so your ear is on your shoulder is changing your roll), which shouldn't need changing at all.

If you know your trig, you don't have to mess with this. Just draw a triangle here, an angle there, a little "opposite over adjacent" action, and you plug in the right numbers the first time. Or, if you're just good at visualizing this kind of thing, you can plug in "pretty close" numbers and just tweak them.


 

Posted

These posts have been very informative.

I'm using a combination of suggestions now and have gotten some brilliant shots.


[IMG]http://i7.photobucket.com/albums/y263/parker_daoc/CoH/layoutcopy.png[/IMG]
[url=http://justicecorps.guildportal.com/Guild.aspx?GuildID=337077&TabID=2821537]Justice Corps[/url] on Virtue Server! ... @Strongwall

 

Posted

Heh, think yourself lucky that the demorecord doesn't use quaternions (that COH most likely uses internally).


 

Posted

Haha, yeah, I could imagine the looks:

"Alright guys, if you wanna move your char across the screen, calculate this Translation matrix, Rotation matrix. Here's the World Matrix. Now remember if you're going to do an Arbitrary Axis Rotation, don't forget the 2nd Skew matrix is squared. Now for the camera to move multiply these two Quaternions (a1a2 - V1V1, a2V1 + a1V2 + V1xV2) and you should be good to go. So now that you've moved one step and shifted the camera..."

O.O

/e passout


 

Posted

Ugh... matrixeseses.... Such an easy class it seemed. Add the matrix... trivial. Invert... trivial. Find the determinant... tedious but trivial... jeez, how can anyone not ace this course? OK, now we are going to put a matrix in Jordan Cononical Form...... &lt;choke&gt; The last test was so hard that passing was not an option. It was just a question of whether I would do so bad on the test that I would fail the entire course. I've never seen a college course go from "pud" to "weed-out" so fast. It was like a lollypop where you bite into it expecting a fudge center and then find out it's full of concentrated pickle juice.


 

Posted

[ QUOTE ]
It was like a lollypop where you bite into it expecting a fudge center and then find out it's full of concentrated pickle juice.

[/ QUOTE ]

EWWWW! a fudge center?!


-Listen to my Light!
-MA #1065 "Star Struck"

 

Posted

OK, for someone better with this than I am:

I have a camera at coordinates x1,z1,y1 and I want it to "look at" the coordinates x2,z2,y2. I want the formulas to get the proper pitch, yaw and roll in a way I can enter them into Excel. Any takers? A link to an Excel file uploaded somewhere that does exactly that would be a huge bonus.


www.SaveCOH.com: Calls to Action and Events Calendar
This is what 3700 heroes in a single zone looks like.
Thanks to @EnsonsDeath for the GVE code that made me VIP again!

 

Posted

Ordinarily, I'd just tell somebody to figure it out from my previous post. However, I thought that the person who wrote the Splasher deserved a bit more. So, try this. (Besides, I think the formulas I posted before were a bit off, which makes me think that nobody actually tried to use all that trig. So much for that.)

I haven't verified the formulas in this spreadsheet, either, so tell me if points stuff in the wrong direction. It should be self-explanatory to use.