hi,
i have my project on island and i want to create something like a boundary around a map so that my camera will be forbidden to go in water or jump of a dock into water any ideas?
thanks.
howto create boundaries around map? DONT allow swimming
howto create boundaries around map? DONT allow swimming
using Visual Studio 2003 , I use 3D Max 7, I love irrlicht its a really good and easy engine
You could do a tile/cell based approach where you create a very low-level 'map' of your environment by simply having a boolean 2D array which you then mark in each cell of the array whether that part of the world is allowed to be entered. Here's a little pic to show what i mean:
So the grid is just overlaid on a sketch of what your island might look like and then the crosses mean cells you're not allowed to enter (didnt fill them all in)
get the idea?
So the grid is just overlaid on a sketch of what your island might look like and then the crosses mean cells you're not allowed to enter (didnt fill them all in)
get the idea?
I have another idea...
you can create an invisible (full transparent) mesh for the border and add it to the physics (collision)...
so if you try to pass the border you hit the invisible "wall" and can't go further...
you can create an invisible (full transparent) mesh for the border and add it to the physics (collision)...
so if you try to pass the border you hit the invisible "wall" and can't go further...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
That's a good idea too. I suppose it could depend on how complicated that mesh would end up as to how well that would perform. I imagine the grid would be better performance as it's just working it out the cell you're in from your position and then checking a boolean value which i imagine would be quicker than doing collision detection on what could be a huge mesh.
If water is done per height level, then simply don't allow the camera/player object to go below a certain level...
rough pseudo logic:
if the next "step"(frame) would take you below the shoreline, then return to last camera/player object position.
Devise some method of preventing choppiness when at a border height (running into the shoreline, for example.)
This method would have the advantage of being applicable to other maps, requiring only data that already exists, and 0 custom work done to achieve the desired results.
Also, no matter what, you'll need invisible walls around docks and structures that extend over the water. Instead of implementing physics, however, simply do a "zoned" approach. Create a zone area, with 3 lines representing the "walls" that restrict movement.
If the player/camera is "inside" the lines, then prevent motion beyond them. Make sure you make it slippery when you contact a border, so that the camera doesn't stick in one spot.
No other check should be needed.
rough pseudo logic:
if the next "step"(frame) would take you below the shoreline, then return to last camera/player object position.
Devise some method of preventing choppiness when at a border height (running into the shoreline, for example.)
This method would have the advantage of being applicable to other maps, requiring only data that already exists, and 0 custom work done to achieve the desired results.
Also, no matter what, you'll need invisible walls around docks and structures that extend over the water. Instead of implementing physics, however, simply do a "zoned" approach. Create a zone area, with 3 lines representing the "walls" that restrict movement.
If the player/camera is "inside" the lines, then prevent motion beyond them. Make sure you make it slippery when you contact a border, so that the camera doesn't stick in one spot.
No other check should be needed.
well thanks for ideas all of them are good, and the easyest would be JRowe47's idea about water level, but i also have a volcano on top of island so i think ill be using the grids. or invisible walls, ill try to make my islands boxlike.
using Visual Studio 2003 , I use 3D Max 7, I love irrlicht its a really good and easy engine
well a better idea would be to check if the player is above the land and stop moving him when he leaves the land. just do a raycast down
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.