Exile007 Posted May 23, 2008 Share Posted May 23, 2008 Hey Holowan, I've been trying to place some cameras into a few custom modules of mine, and as I read the tutorial here I thought that I could simply use the Whereami armband to grab the two fields quickly for the orientation of the camera. I guess I was mistaken when my camera pointed at the wall. I'm guessing that this means that the whereami armband cannot be used to calculate the fields? If not, could someone tell me how to calculate the fields of the camera? That'd be great. Link to comment Share on other sites More sharing options...
DarthStoney Posted May 23, 2008 Share Posted May 23, 2008 I found this to be very helpful for camera placing:http://www.lucasforums.com/showthread.php?s=&threadid=145924#post1775401 Specifically this part of the thread its not exact but it seems to work fairly well the only thing I found is north may not match up to north in the module sometimes. 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. Link to comment Share on other sites More sharing options...
Exile007 Posted May 23, 2008 Author Share Posted May 23, 2008 I found this to be very helpful for camera placing:http://www.lucasforums.com/showthread.php?s=&threadid=145924#post1775401 Specifically this part of the thread its not exact but it seems to work fairly well the only thing I found is north may not match up to north in the module sometimes. Okay, let me see if my dead brain can try to comprehend. Basically, whereami can be used to calculate the camera angle, BUT you must be standing in the opposite direction in which you want the camera to face when you use the whereami armband? Please correct me if I'm wrong. Link to comment Share on other sites More sharing options...
DarthStoney Posted May 23, 2008 Share Posted May 23, 2008 The whereami can be used for camera location(just like any placeable). the above formula is for camera angle(which direction the camera faces). The formula I used was: Z = sin (angle/2) Y = 0.0 *always leave middle 2 numbers at 0 X = 0.0 Q = cos (angle/2) To come up with z and q lets say 90 degrees is east and you want the camera facing east. take 90/2=45 (need a calculator for this) z= sin x 45 q= cos x 45. Link to comment Share on other sites More sharing options...
Exile007 Posted May 24, 2008 Author Share Posted May 24, 2008 The whereami can be used for camera location(just like any placeable). the above formula is for camera angle(which direction the camera faces). The formula I used was: Z = sin (angle/2) Y = 0.0 *always leave middle 2 numbers at 0 X = 0.0 Q = cos (angle/2) To come up with z and q lets say 90 degrees is east and you want the camera facing east. take 90/2=45 (need a calculator for this) z= sin x 45 q= cos x 45. Eh, sorry for being such a newbie, but for some reason the camera always points at the same wall. I marked both z and q as 45, as that is what they should have been. Should I have put sin and cos as well? Eh, I'm sorry for being such an idiot. Link to comment Share on other sites More sharing options...
Robespierre Posted May 24, 2008 Share Posted May 24, 2008 Did you just put 45 in as Z and Q? Ah, then there's you're problem: If you understand this: 0 degrees = North 90 degrees = East 180 = South 270 = West Then the hard part's over. All you need to do now is get a scientific calculator and use the formula: Z=sin(angle/2), Q=cos(angle/2). Essentially, you halve the angle and then do sin of that angle. If you have done trigonometry or circular functions you'll understand why this works, but if you haven't then just roll with it. So if you have the angle you want as 90, then you halve that to 45. Then you stick that in your calculator and you get Z = sin45 = 0.7071. Then Q = cos45 = 0.7071. Yes, they're supposed to be the same - you'll understand why if you've done it in school, but just trust me, they're not all the same, just when the angle is 45 degrees. Any questions class? Link to comment Share on other sites More sharing options...
Exile007 Posted May 24, 2008 Author Share Posted May 24, 2008 Did you just put 45 in as Z and Q? Ah, then there's you're problem: If you understand this: Then the hard part's over. All you need to do now is get a scientific calculator and use the formula: Z=sin(angle/2), Q=cos(angle/2). Essentially, you halve the angle and then do sin of that angle. If you have done trigonometry or circular functions you'll understand why this works, but if you haven't then just roll with it. So if you have the angle you want as 90, then you halve that to 45. Then you stick that in your calculator and you get Z = sin45 = 0.7071. Then Q = cos45 = 0.7071. Yes, they're supposed to be the same - you'll understand why if you've done it in school, but just trust me, they're not all the same, just when the angle is 45 degrees. Any questions class? Yes, can we have our tests back? Thanks a lot guys, I'm bookmarking this page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.