Jump to content

  • Log In with Google      Sign In   
  • Create Account

Keeping camera inside map bounds


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1   Members   -  Reputation: 349

Like
0Likes
Like

Posted 24 July 2014 - 01:14 PM

I have a 3d game where players can explore small maps.

Each map is bounded by walls, except for some exits.

Right now if players come close to an exit, they can look outside the map and see a skybox, this is bad.

 

I want the camera to be able to roam free, except in places where it would let players see outside.

There are some contraints, for example the camera always points down, so it is not possible to see the sky.

 

What kind of approach should I take?



#2   Members   -  Reputation: 5224

Like
1Likes
Like

Posted 25 July 2014 - 02:51 PM

I have a 3d game where players can explore small maps.

Each map is bounded by walls, except for some exits.

Right now if players come close to an exit, they can look outside the map and see a skybox, this is bad.

 

I want the camera to be able to roam free, except in places where it would let players see outside.

There are some contraints, for example the camera always points down, so it is not possible to see the sky.

 

What kind of approach should I take?

 

Create a bounding box smaller than the level, and constrain the camera to never move outside of that?



#3   Members   -  Reputation: 349

Like
0Likes
Like

Posted 25 July 2014 - 02:57 PM


Create a bounding box smaller than the level, and constrain the camera to never move outside of that?

 

 

The camera is defined by two things, position and view direction.

Constraining the position to a box is trivial, sure, but the problem is constraining the view direction so the limits of the map are never visible.

 

My camera view direction vector can have any value except having the Y component pointing up (to the sky).

So I'm interested in knowing what kind of math could be used in this case.



#4   Crossbones+   -  Reputation: 1709

Like
2Likes
Like

Posted 25 July 2014 - 04:13 PM

The typical solution is to just pad the skirt of the map -- past the farthest distance the player would ever be able to see -- with additional artwork to cover up the skybox/background/etc. This ensures that the camera never interferes with gameplay while also hiding the rough edges.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS