Jump to content

camera angles


Rick
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...