SURs - How to: #2 - About Surface (SUR) Files
-
.OBJ to .SUR Converter - How To:
#2 - About Surface (SUR) Files
Freelancer needs SUR files to generate collisions/physics of objects and their groups. A SUR group always must have the same name of the CMP group it is assigned to (do not forget the common _lod1 ending!). Because of this, SUR groups always move with their parent CMP group. They do not move with other SUR groups. Every single SUR group can consist of multiple convex meshes (see last Chapter).
For Freelancer there are four kinds of SUR groups:
The following explanations are valid for NPCs and just partially for players! (See below)
Root Group
Root groups are assigned to the CMPs/3DBs root group. They can’t be animated, moved or separated/destroyed. They will always collide as long as it’s parent group exists.
Static Groups
For multi part objects you need to use Static groups. They are, as always, parented to the CMP group with the same name. They can be destroyed/separated and their assigned CMP group moves with them through space as soon as this happened. Static groups are not recommended for animated groups!
Static is cheap to compute and must be always used if the additional group is not meant to be animated!Moveable Groups
To create physics/collisions for animated CMP groups, you have to use Moveable groups and assign them to their CMP counterpart. They can also be separated/destroyed and act as Static groups.
Just use Moveable groups if the group is meant to be animated, because they are more expensive to compute!Hardpoint SURs
Hardpoint groups must have the exact name of the hardpoint they are assigned to!
These groups are used/activated as soon as the hardpoint is used. However, they are not separable. They are a health proxy for the equipment mounted there. They also collide with other objects.You can of course parent groups to other groups. And if a group in between gets separated or is animated, its child groups will always move together with their parent. In case of animations, Hardpoint or Static groups will follow this animation, but aren’t updated often (“jumping around”).
Freelancer-Caused Problems With Group Collisions
We all know, Freelancer always has surprises for us. And for SURs we have some problems caused by how Freelancer works.
All those things you read about the groups so far are valid for NPCs. For players, there are some limitations/bugs:Static Groups
If a player loses a Static SUR group of his own ship (for example a wing), he will still collide with this “not existing” part.
(Sometimes there are bugs that cause no collision, but this is not intended.)Moveable Groups
The player never collides with Moveable SUR groups of his own ship. So, always try to avoid Moveable SUR groups on player ships!
Hardpoint SURs
Hardpoints on the players own ship will never be deactivated. They will always collide, even if there is no gun attached to.
Additional, a player will never be able to collide with his own debris (if you lost a wing, you can’t collide with it).
Other players are always treated like NPCs! So their Moveable groups will collide with you, their destroyed Static parts will not hit you, their debris will damage you, their not used hardpoints will not collide with you. Like NPCs.
All those limitations you just read are only valid for your own ship you are flying and nobody else.Some technical background information for interested people:
Static groups will always be twice in a model. One version of it is always where it is placed in the OBJ file. The second one is placed on the center coordinates (by default: 0,0,0). The first one is working for collisions if it is still part of the ship, the second one gets activated as soon as the part gets separated.
Moveable groups will always just exist once in the SUR. This makes them freely moveable, because they are “separated from beginning on”.
Any questions? Ask!