racer home

Movable Objects

 

Home Give it some wings.


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

Introduction

Racer v0.8.3 experiments with the Newton physics engine (instead of ODE). This made it easier to add movable objects; things like cones / haybales and such that move when hit.

What are movable objects?

Movable objects (called 'movables' in short) are used to define dynamic objects on a track. v0.5.3beta2.1 only had cones, but v0.8.3 supports track objects to be turned into a movable object.

2 types of movable objects exist: the ones specified in movables001.ini and track objects that have their 'movable' flag set (you can use TrackEd for this).

Separating the movable objects (using movables001.ini) from the track allows for these objects to be dynamically placed for example (cars hitting cones for example). Racer v0.8.3. adds a 'movable' flags to 'geometry.ini'. The in-track movables will only work with the Newton physics engine. Actually, the in-track movable objects are more interesting probably than the dynamically added movables. Those can only be cones, whereas with in-track movables you can transform a 3D modeled object in your track to a dynamic model.

Notice that dynamic models can have a profound impact on the physics engine performance, so don't throw around dynamic objects carelessly.

First, the separate movable objects (from movables001.ini) are explained. After that, the in-track objects are handled.

How do I define movable objects? (movables001.ini)

With TrackEd you can add and maintain the movables. Use 'Create object' to create a single object, or 'Create group' to create a bunch of them at once. In the latter case, use one of the 'Shape' buttons to apply a layout to the objects. Each object is a member of a group.

Movable groups (movables001.ini)

To create a grid of movables, first select a line along which to place the objects. The line's direction will be the direction along which the objects will be layed out. Then, click 'Create group' which allows creation of multiple objects at once (in the same group number). A new group index will be used (the next group available; note that creating a single object also creates a group, with that object as the sole member) for the new objects.
After creation of the group all the objects will be on the same position (at the selection's start point). Note that the first object of the new group has been automatically selected.
Next, click 'Shape group: grid' to assign a layout to the group. 3 parameters will be asked: 'Longitudinal length' is the length along which to space the objects (which is automatically set to the length of the selection line). 'Lateral width' is the sideways width on which to space the objects laterally (side to side). Lastly, you enter the number of rows, meaning how many objects are placed on a single lateral line.
The group is then layed out along the selection line according to these parameters.

Defining movable objects (in-track)

You can use TrackEd to select objects and turn on their 'Movable' flag. Turn on 'Objects' mode (F4), then hold SHIFT and click on an object. It will flash. Then, press Ctrl-M or click the 'Toggle flag: Movable' button. Then save (Shift-S) and try your track.

In the track's geometry.ini file, you can see that the flag 1024 will be turned on for movable objects. You can add more properties (directly in geometry.ini) to define the type of collision, mass etc. For example:

conea_0_cone32
{
  file=conea_0_cone32.dof
  flags=1024
  mass=10
  inertia=0.4 0.4 0.4
  shape=1
}

Here, the mass indicates the object's mass in kilograms. The inertia numbers define the inertia tensor's diagonal values; essentially the same as a car's inertia values. These 3 values are the X, Y and Z inertia values. If undefined, the mass is used to calculate a cube-like default inertia matrix, which has values of 1/6*M*L^2 (where M=mass, L=length of cube). Since not all models will be cube-shaped, the average length is used for L.

The shape variable indicates the type of collision geometry. 0 (the default) indicates a box; 1 indicates a sphere. Note that spheres tend to roll away, so if all objects start to roll away at the start, be prepared to notice a severe performance issues.

 


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated November 13, 2012 )