Unknown
From DarkAI
AI
ADD OBSTACLE FROM LEVEL
This command creates a set
of obstacles from a mesh, for example an entire level, by using the
polygons that make it up to work out where the walls are. This can be
used to quickly and easily add all the collision data you need for
large levels and then add the smaller obstacles afterwards. You can
also make this command output a list of obstacles to a file so that
you can change it and add it manually to your own code if one or more
parts are not quite right, this will be put in the same folder as the
.exe in a file called 'Obstacle Data.txt'. Any file that already
exists with this name will be over written.
It does this by
taking a flat plane, at the height you specify, and calculating all
polygons that intersect it. This provides a rough idea of where the
polygons that represent walls are located, it ignores any polygons
that are orientated at less than 45 degrees or that are smaller in Y
size than Min Height. The polygons create lines of
intersection across the plane, any lines that are less that Min
Length are ignored. Lines that are close to each other (within
the radius defined with AI Set Radius) are merged and then used
directly as obstacles with two vertices. These create double sided
obstacles that will allow movement on both sides but not through it,
as opposed to a boundary which will not allow movement outside of it.
You can use AI Debug Show Obstacle Bounds to check the
obstacles produced.
The list of obstacles are added to
container 0 as full height obstacles with obstacle id 0. The code to
create the list of obstacles produced can be output to a file by
setting Output To File to 1, this will not add the obstacles
to the AI system. You will still need to place obstacles to represent
windows which may leave a hole in a wall at the height you specify.
You can do this at any time before or after this command. You can
change the container they are added to and the height (full height or
half height) using the Container Number
and Height
parameters.
AI Complete Obstacles must be called
some time after this command, after all static obstacles have been
added, to complete the setup and produce waypoint data for the
obstacles.
Syntax
AI Add Obstacle From Level Object
Number, Plane Height#, Min Length#, Min Height#
AI
Add Obstacle From Level Object Number, Container Number,
Plane Height#, Min Length#, Min Height#
AI
Add Obstacle From Level Object Number, Container Number,
Height, Plane Height#, Min Length#, Min Height#
AI Add
Obstacle From Level Object Number, Container Number, Height, Plane
Height#, Min Length#, Min Height#, Output To
File
Parameters
Obstacle Number, The id
of the object you want to create obstacles from.
Container
Number, (optional) The id of the
container you want to add the obstacles to.
Height,
(optional) The height you want the obstacles to be, full-height(1) or
half-height(0).
Plane Height#, The height in world
co-ordinates that you want obstacles from.
Min Length#, The
minimum intersection length that can create an obstacle.
Min
Height#, The minimum height of a polygon for it to contribute to
obstacles.
Output To File, (optional) Set to 1 to output
the code for creating the obstacles, 0 to add straight to the AI
system. Default is 0.
Return
n/a