Jump to content

Keeping players on the map


Clackdor
 Share

Recommended Posts

What methods do you recommend for keeping players from falling off of the map that you create with editor? I was just making impassible terrain, but I'm not liking how the map is turning out using that method. Is there a command for limiting the field of play that will stop the player cold?

Link to comment
Share on other sites

My way almost feels like a WorldCraft style hack.

 

Create an invisible entity called something like "WorldLimits"

give it two properties: Min and Max. Each is a Vec3.

Use these properties to create an inside-out cube (This way you actually collide with it when trying to leave the map, rather than when trying to enter it which is what would happen if it wasn't inside-out)

(Either try to create it in code, or create it 1x1x1 in a modelling app, and then resize it to the correct size.)

Then simply hide the cube so it's never visible, and give it a mass of 0 so that nothing can budge it.

 

 

I do it in code, but then again, I don't use the built-in Newton, so it's much easier to create any physics shape I want to, on-the-fly. LE2 is rather dependent on .phy files when using the built in version of Newton

 

Edit: Make sure the world size (use SetWorldSize()) is big enough to accept your cube otherwise it won't work properly. Bodies will simply freeze when they reach the world limits, and and raycasts will never hit it. The world size should be just a bit bigger in case something, somehow breaks through the cube, at which point when it leaves the world, you can either reposition, or delete the body in question.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

This is where nav meshes (or other path finding constructs) can come in useful in limiting the player motion or rather confining them to just those areas. Failing that, a simple constraint on the x and z movement to reflect the size of the traversable area such that if the player attempts to move beyond those extents they are simple ignored would do the trick. Invisible objects (geometry) would be a second suggestion where collision with such objects would halt motion beyond that point.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

I just surround my terain with a large sea or lake and although you can walk thru it until you drop off the map what would be the point as there is nothing out there

If you are trying to portray an historically accurate world, this is the correct physics model to use!

 

In early Mesopotamian mythology, the world was portrayed as a flat disk floating in the ocean and surrounded by a spherical sky

Too bad they didn't have computers back then so they could put those theories into practice :D

 

...

I would suggest methods already mentioned, but consider that you don't want to just stop the player cold, that's not fun especially if you are moving fast like in a vehicle. It's better if you can do it in a nice rubber kind of way instead of an invisible brick wall. Warn and slowly stop or turn the player back to the playing field, by checking if position is out off 'soft' bounds and throttling or clamping movement values on appropriate axes, then have a physics body for the outermost 'hard' bounds, that catches all other objects or those that break through the 'soft' limits. I prefer more visual and realistic restraints like impassable terrain because then I can expect it's probably the end of map, instead of going very far out into the desert only to find an invisible wall at some point.

Link to comment
Share on other sites

..in case you dont have specific pathfind system in place..most effective and very simple way is to have one large bounding box, with bounding space slightly smaller than your world..then just check is your character of interest, intruding or not that bounding space..if yes, its all just fine..if not, just turn character toward center of your bounding space until its intruded...simple as it is..

 

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