Xcom Posted April 17, 2005 Author Share Posted April 17, 2005 Well, I got the coordinates .. accidentally. Still have no idea how this orientation system works. I guess making custom placeable cameras isn't going to be easy. Link to comment Share on other sites More sharing options...
tk102 Posted April 17, 2005 Share Posted April 17, 2005 Yeah, Fred Tetra and I never really figured it out either. We assumed A,B,C,D as you called them formed a quaternion, but the camera didn't behave as expected when I tested this theory. Link to comment Share on other sites More sharing options...
Xcom Posted April 18, 2005 Author Share Posted April 18, 2005 Originally posted by tk102 but the camera didn't behave as expected when I tested this theory. Viva la "quaternion theory". I think I may have got the computations right although it still needs some testing Z = sin (angle/2) Y = 0.0 X = 0.0 Q = cos (angle/2) However getting the actual "angle" is tricky. Apparently (according to my tests here), the coordinate system for the camera is flipped... or something. 0 degrees = North 90 degrees = East 180 = South 270 = West So it goes clockwise unlike normal game orientation which anti-clockwise (like for creatures and placeables). When you get reverse facing angle from whereami, you need to do some tweaking, considering it starts from the east and goes anti-clockwise. Anyways, thanks. Link to comment Share on other sites More sharing options...
tk102 Posted April 18, 2005 Share Posted April 18, 2005 Maybe I should've tried something simple like that. I was attempting to flip the camera upside-down. Well Xcom this is going to eventually make its way into a tutorial so if you want to flesh out your findings or write anything more for posterity feel free. Link to comment Share on other sites More sharing options...
Fred Tetra Posted April 18, 2005 Share Posted April 18, 2005 There are at least two angular representation techinques used in KotOR. In the first, an angle from 0 to 360 degrees clockwise is represented in KotOR as a number in radians, with 90 deg (east) = 0 radians and 270 deg = +/- pi ("normal" trig values). This is used for placeable objects, for example. If XYAngle > 90 Then value = (270 - XYAngle) / 180 * Pi otherwise... value = (-(XYAngle + 90)) / 180 * Pi In the second, 0 deg (north) = 0 radians and 180 deg = +/- pi. This is used for doors, for example. If XYAngle > 180 Then value = -(XYAngle - 180) / 180 * Pi otherwise... value = (180 - XYAngle) / 180 * Pi These are the only two I've seen used. You can use regular quaternion formulas to convert from axis and rotation angle to quaternion. Oh, and I do remember getting the camera to flip upside down and tilt, creating many 1960's Batman fight scene-like shots in the cinematics. Link to comment Share on other sites More sharing options...
brwarner Posted October 11, 2005 Share Posted October 11, 2005 These cameras don't work. I've tried CamEdit and I put in the values and I used the module editor to see where it was and when I use it in game I can't tell what I'm looking at. I see a wall but not the one I want. Just to clarify if i'm looking from a plan view x orientation would be rotating <--> like that and y like that but rotated 90 and z like rotating on this circle (). I ask because when I do it like this it doesn't work. Also with those orientations what's pitch for? Link to comment Share on other sites More sharing options...
Darth333 Posted October 12, 2005 Share Posted October 12, 2005 Camera angles in Kotor are truly evil : unless you are using the latest Kotor tool module editor (your map has to be available), you'll have to get into quarternion calculations. For your fun: http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm However, with the latest version of Kotor Tool you can now set the camrera angles (yaw, pitch and roll) in degrees For a visual explanation and since I'm an aviation girl , I give you the example of an aircraft (it works more or less the same with a camera): pitch is the rotation around a transverse (side-to-side) axis . Straight down is a –90 degree, level is 0 degrees, and straight up is 90 degrees pitch roll is the rotation around the longitudinal (front-to-back) axis. To the left it is –90 degrees, normal position is zero degrees, to the right it's 90 degrees, upside down is 180 or -180. and Yaw (or bearing) is the rotation around a vertical axis (a pivot center point). Yaw can be set from -180 to 180 degrees with 0 degrees pointing north (in aviation 0 degrees would point East however ) For example, a plane or a camera which is not leaning and which is pointing straight up would have a yaw of 0, a pitch of 90 degrees, and a roll of 0 For more details, see this post: http://www.lucasforums.com/showpost.php?p=1886219&postcount=1257 If someone more familiar with real Euler angles wants to step in, feel free to do so as there are a few differences with aviation . If you want to use existing cameras in a modules, you can use the script provided by xcom above to find the cameras in a module. Then specify the camera ID in your script on in the .dlg file. You can also specify the camera angle in the .dlg file (see xcom's post above: http://www.lucasforums.com/showpost.php?p=1775401&postcount=20). However, some angles may give you a wall view depending on the orientation of the camera you are using. And if you are working with a module that does not exist for the Kotor tool module editor, use K-GFF and you won't need Camedit (you'll still have the quarternion fun however). Link to comment Share on other sites More sharing options...
Det. Bart Lasiter Posted October 13, 2005 Share Posted October 13, 2005 Here is a good link for the usage of quaternions within a game engine. However for just mathematical usage, I recommend XPascal or some sort of math-specialized language like that where you can just create a new routine and enter something along the lines of this: begin. QuatRotation(fx, fy, fz, fr); end. Although you'd need something more complex than that to return value(s) Link to comment Share on other sites More sharing options...
Fred Tetra Posted October 13, 2005 Share Posted October 13, 2005 For example, a plane or a camera which is not leaning and which is pointing straight up would have a yaw of 0, a pitch of 90 degrees, and a roll of 0. For Kotor cameras, the pitch has to be 90 degrees to look straight ahead. The value is the number of degrees to rotate "up" from looking at the floor. Beware traversing the range 0 -> -180 degrees; while -180 will look at the ceiling just like +180, you "get there" by having the camera upside down. Setting the Roll too high (+ or -) will make the scene look like something out of a 1960's batman bad-guy confrontation! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.