Right now, the only way to model scenes in Behaviour is through editing datafiles. If you are familiar with POVRay, I think you will be familiar with Behaviour's datafiles too. While it might not be the best way to achieve quick results, I think it's good to have textfiles as a base, and then build modelers which output textfiles. I have created two small tools which can assist in the modeling process. They are written in plain C and operate by writing data to standard output in a shell.
The two tools have a similar interface to eachother. They take some parameters and output a complete datafile. The thought is that you should then edit these and cut and paste together the pieces you want to create the scene with.
The principle behind the generated models is that a sphere is a reasonable approximation of a cube except at the corners. If we arrange several spheres together in a plane, with even spacing, and with some overlapping, we will get a quite even surface. We can then stack several planes on top of eachother to get a block. The ellipsoid works with the same principle, only the plane is warped and the spacing is not even.
We can now define a vector which lies on the outside surface of this block or ellipsoid. First we produce a vector between an outer sphere, and one in the next layer. This vector is then elongated by the radius of the spheres, and then added to the sphere in the inner layer. If we do this for the entire block or ellipsoid (substitute the inner layer with the center object for the ellipsoid), we will get a mesh defining the hull of the model. This mesh will also dynamically deform itself to fit the model if the objects of the model are deformed relative to eachother.
Now we can triangulate this mesh to get a filled hull. I have trinagulated by using a chessboard-pattern, which will not give too many artifacts. If we triangulate using only one type of triangle all the way around, we will get ugly lines appearing around the model.
create_block
create_block
will create a solid block out of evenly spaced
objects. It takes 4 arguments, the first three are dimensions, xcount,
ycount, zcount, ie. how many objects should make up each side. The
last argument is a prefix which will be added before every name to avoid
name clashes between different models. An example might look like this:
create_block 3 4 5 myblock > myblock.bdat
The documentation for the parameters in the datafile is in the generated datafile itself.
create_ellipsoid
create_ellipsoid
will create an ellipsoid shell out of
stacks and slices. An ellipsoid is an ellipse in 3 dimensions,
ie. a sphere which has been compressed by a certain factor x-wise, y-wise and
z-wise. If these factors are all 1, a sphere is constructed. A stack is a
division of the rotation around the x axis while a slice is a division
around the z axis. This will not create a symmetrical distribution, but
since the lengths of the connections are also varied, it will work decently.
This tool takes 3 arguments: stacks, slices and prefix. The compression factors are specified in the generated datafile, and are dynamic. As in the previous tool, the documentation is in the generated datafile.
The generated ellipsoid will have one object in the center which is connected to all the others. The objects in the shell will also be connected to their immediate neighbors.
The aim was at first to create a solid, symmetric ellipsoid, but this attempt failed. If we start by trying to create a symmetric shell, we will run into problems even there. The only way to get symmetry is to use polyhedra, but at least I don't know any general algorithms for generating polyhedra from a reasonably arbitrary number of vertices. Even if we would succeed with this to some extent, there would be problems getting the symmetry to hold when we solidify the model.
There is one limitation when using stacks and slices, and that is the spacing between the objects which make up the model. The spacing will be very dense at the "ends", while at the center it will be very sparse. Since we have a problem with dense models and friction this will limit the scalability of the ellipsoid.