How to create collisions in a landscape

License

Copyright (C) 2002, Philippe Lamoureux, phlam@noos.fr

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Description

During the build-gamedata process, NeL patches automatically generate a collision layer.
To insert a mesh into your landscape and have your character collide it, you have to manually add collision informations.

This document shows how to create this kind of collisions in 3DSMax and export / test them in the Snowballs demo.

Requisites

You need the following configuration : Backup your original Snowballs files : some of them will be changed by this process.
Copy the original snowball.gr and snowballs.rbank files from /snowballs/data/pacs/ into /build_gamedata/processes/rbank/smooth/

Overall process

Details on collisions

Pairs

In a landscape, every collision system is composed of two objects : an interior and an exterior mesh

Even if there is no need for an interior collision mesh, this mesh must be present :

Here is a simple box placed on the landscape The 'exterior' collision mesh prevents the player from crossing the visible mesh
The 'interior' collision mesh is of no use, but it has to be present.

Frontiers

To have the character walk on a mesh, like a staircase or a ramp, the exterior and interior collision meshes must have overlapping invisible open edges.
Every invisible edge in the exterior mesh must have a corresponding 'snapped' edge in the interior mesh.

Ramp raising from the ground, the player cannot walk under it.
  • The visible edges of the exterior mesh block the user coming from the landscape
  • The visible edges of the interior mesh prevent the user from falling out of the ramp
  • The superposed invisible edges of both the interior and the exterior meshes indicate a connection between the landscape and the ramp

Objects informations and constraints

Complex collisions

The following example is composed of two collision systems
A connection between the landscape and the ramp, but the exterior mesh only blocks the path around the start : the player can walk under the ramp. A collision at the base of the ramp.

Remark

For now this system cannot create bridges.
You can have a collision that has two or more distinct connections with the landscape, but the exterior mesh cannot be broken into multiple meshes, so you couldn't go onto and under a bridge