- 1 Collision Volumes
- 1.1 What is a collision volume?
- 1.2 How to see them ingame
- 1.3 What else are they used for?
- 1.4 How to edit their shape
- 1.5 Can they be changed during gameplay?
- 1.6 Unit radius & height VS collision volume
- 1.7 Which spot on an enemy do units target
- 1.8 Common problems (and how to solve)
What is a collision volume?
The collision volume is a geometric shape around Spring units and features. If a projectile collides with this shape, the engine registers it as a hit. Other names are hitbox, hitsphere etc.
How to see them ingame
Press alt + v or type /debugcolvol into chat. Look at the purple wireframe shapes around units. If you can not see them, the collision volume might be blocked from view by the 3D model or be very offset like underground or in the sky. Red shapes indicate the unit was hit.
What else are they used for?
- line-of-fire calculations
- mouse-click detection when selecting a single unit
How to edit their shape
In the 3D view, click on the blue "3D" text and a menu opens.
Click "draw model radius + height"
At the right side, go to the "Model" tab and edit the values.
With Upspring, you can only define sphere shaped collision volumes.
In the Def
There are numerous tags that control shape, size and position of the collision volume. You have to restart Springfor the changes to take effect, there is no way to reload unit and feature defs.
boxxy the hitbox editor
This creation allows you move hitboxes by pressing buttons. This way you can get the needed numbers and copy them to the unitdef file.
Its Boxxy! (forum)
Multiple collision volumes
A unit can have multiple collision volumes. For example a tank could use a box for the chassis and a cylinder for the turret.
Each piece can have its own collision volume. usePieceCollisionVolumes = true, will cause each piece on the model to have an autogenerated hitvolume; unwanted hitvolumes can then be removed with Lua.
Can they be changed during gameplay?
Yes. One example would be "pop up" turrets that get a smaller hitbox when sunken into the ground etc.
Unit radius & height VS collision volume
Even when a unit defines a collision volume that is not a sphere, the radius and height values set in Upspring still have a number of purposes. To name a few examples: height is used to decide whether a ship can move over an underwater structure, radius is used in collision handling for aircraft. Most importantly, all collision checks first do a pre-check with the unit radius before doing the colvol checks. Ergo the unit radius must be larger or equal to the colvol!
Which spot on an enemy do units target
The model centre set in Upspring
Common problems (and how to solve)
weapons miss the unit
Weapons like Dgun and torpedos might pass through under the unit if the hitvolume does not extend a bit into the ground/underwater.
Two near units might refuse to shoot if their turrets intersect with each other's hitboxes.