Model debug flags

From PioneerWiki
Jump to: navigation, search

The model system can be instructed to draw models with extra information visible, such as the collision mesh, tag locations, etc. The same information that is available in the modelviewer is also available in-game. Here's how to activate it via the console.

Getting a model reference

You need to get a reference to a model into the console environment. Every model-based physical body (that is anything inheriting from ModelBody: ships, spacestations, cargo, missiles) has a model attribute attached. For the player, that's available as:

model = import('Game').player.model

For other models, the easiest way to get a reference to the body is to target the object and then obtain the navtarget or combat target from the player:

model = import('Game').player:GetNavTarget().model
model = import('Game').player:GetCombatTarget().model

Set debug flags

Once you've got a model reference, pass a list of the flags you want to enable to its SetDebugFlags() method:

model:SetDebugFlags({"BBOX","COLLMESH"})

To disable all flags, pass an empty list:

model:SetDebugFlags({})

Available flags

BBOX - Bounding box

Displays the axis-aligned bounding box of the model. This includes the shield mesh, even if its not currently on screen. The bounding box is used for early collision culling and body size estimates.

Model-debug-bbox.png

COLLMESH - Collision mesh

Displays the collision mesh of the model. Also shows special collision-based surfaces (such as docking surfaces).

Model-debug-collmesh.png

Model-debug-collmesh-station.png

WIREFRAME - Wireframe mode

Draws the model in wireframe. This can result in a performance hit on complex modes.

Model-debug-wireframe.png

TAGS - Show model tags

Draws an axis indicator at any tag_ points defined on the model.

Model-debug-tags.png

DOCKING - Show docking positions

Draws an axis indicator at docking points defined on the model (typically a station). Currently the points are drawn quite small, making them difficult to see from a distance.

Model-debug-docking-station.png