Collision_Notes

Rendercollision

What It Does

If you go into the fakeconsole and activate rendercollision, then go into freecam mode it renders all of the collision geometry and it colors your buildings and other static models.

The red lines represent the collision geometry

The purple lines represent the primitives geometry

The white lines represent the bounding box.

A large collision mesh means that no matter where a soldier stands on that object, at some level they must be compared against ALL of that other geometry. The game has to calculate their collision against the whole object. If you were thinking, Well, it's a large object, it should have more than a thousand verts," then that object needs to be broken apart so that the engine is not testing against the whole object all the time.

Use p_collision for the easy parts, and collision mesh for the complicated situations. If you want those frames-per-second back, optimizing collision is just one thing you need to do.

In case you don't know what p_collision is it's a primitive being used for collision. That typically means a cube or sphere that has not been distorted and is more efficient than a custom polygon.

Collision in the ODF

CollisionThreshold and CollisionScale

Default values:

CollisionThreshold = "10.0 3.0 0.0"

CollisionScale = "1.0 0.0 0.0"

If the impact velocity exceeds the collision threshold:

Damage = collision scale * (impact velocity - collision threshold) ^ 2

Vehicle Types

VehicleType = "light"

This plays into the collision system and how the vehicle will interact with the world. Specifically how a vehicle detects objects in the environment and reacts such as ai turning in time or moving around the object.

Options include:

fighter

transport

scout

remoteterminal

light

medium

heavy

Values in all_fly_xwing.odf:

CollisionThreshold = 1.0

CollisionScale = "4.5 4.5 4.5"

These values won't do what I think you meant. It's explanation time:

The first component is the constant part, independent of direction.

The second component is the gradient along the up direction

positive values make the value larger for hits from the bottom, and smaller for hits from the top

negative values make the value larger for hits from the top, and smaller for hits from the bottom

The third component is the gradient along the front direction

positive values make the value larger for hits from the back, and smaller for hits from the top

negative values make the value larger for hits from the front, and smaller for hits from the back

(that may seem counterintuitive, but that's how it works.)

CollisionThreshold sets the speed above which the object will take damage.

Damage is proportional to speed above the threshold, squared.

CollisionScale multiplies the damage done.

CollisionDamage = (CollisionScale based on collision normal) * ((speed along collision normal) - (CollisionThreshold based on collision normal)) ^ 2

Default values for comparison:

CollisionThreshold = "7.5 2.5 0.0"

CollisionScale = "1.0 0.0 0.0"

The default collision threshold is 7.5 meters per second, +2.5 for a total of 10.0 from the bottom, -2.5 for a total of 5.0 from the top.

The default collision scale is a constant 1.0, with no gradient along the up or front directions.

All meshes automatically generates collision when they are munged, using the "raw" geometry, that is loaded into the game.

For things that are not using its collision, we need an .option file with the parameter -nocollision in it.

Example on where this should be done:

-Skinned guys

-Droideka

-Foliage

-Interface models

-Effects