Rick Posted December 29, 2009 Share Posted December 29, 2009 So I'm having an issue with my camera angle on the Y axis. So I have my camera rotating around the target just fine. You can go all the way around it, but I need to restrict the camera so it only goes so far when you are looking from above and below. Generally in a 3rd person camera you can only look directly down and not past down, if that makes sense. I use just a number to restrict the y value, but that doesn't seem to always work. The starting point of the camera is defined by the user and can be anywhere from the target. The y value that needs to be set to restrict needs to be different depending on the starting place of the camera from the target. I was hoping there would be some sort of angle way to determine this restriction so it would work no matter what. When the camera is directly above the target object, the angle between the 2 points would be 0, and when it's directly below it would be 180. I'm just not sure how to do that. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 29, 2009 Share Posted December 29, 2009 the fpscontroller.lua has an example of this: camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-90) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 29, 2009 Author Share Posted December 29, 2009 Is there anyway you could post the fpscontroller.lua file here? I don't have access to it from where I am and I'd love to take a look at the code. I'm also thinking that might be different since the fps camera is rotating around itself, where the 3rd person camera is rotating around an different point. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 29, 2009 Author Share Posted December 29, 2009 Oh I think I see now. Since I have a pivot at the player location and the camera is parented to that, I can limit the pivot rotation instead of trying to limit the camera rotation. Since if I stop the pivot, the camera will stop with it. I was trying to limit the camera instead of the pivot. I'll give that a try tonight. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 29, 2009 Author Share Posted December 29, 2009 Actually the more I think about this the more this doesn't seem like it'll work. If the player pivot is the parent to the camera, and the camera is offset behind and up from the player pivot, the player pivot could stop at 90 degress but that doesn't mean the camera is directly above the pivot because of the offset. So I have to be able to take into account the starting position of the camera somewhere to figure out how much the player pivot can go before the camera is directly above/below the player pivot. Maybe I need to get the rotation of the camera pivot, since it's parented to the player pivot, and when the player pivot rotates the camera pivot should rotate with it, and if that's 90 deg I can stop the player pivot from rotating. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.