Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Keeping camera inside map bounds

4: Adsense

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 Relfos   Members   

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 ferrous   Members   

6030
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 Relfos   Members   

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 Zipster   Members   

2257
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.