Difference between revisions of "Model debug flags"

From PioneerWiki
Jump to: navigation, search
(Created page with "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...")
 
m (Updating, with import(), so it actually works from the console.)
 
Line 4: Line 4:
  
 
You need to get a reference to a model into the console environment. Every model-based physical body (that is anything inheriting from&nbsp;<tt>ModelBody</tt>: ships, spacestations, cargo, missiles) has a&nbsp;<tt>model</tt> attribute attached. For the player, that's available as:
 
You need to get a reference to a model into the console environment. Every model-based physical body (that is anything inheriting from&nbsp;<tt>ModelBody</tt>: ships, spacestations, cargo, missiles) has a&nbsp;<tt>model</tt> attribute attached. For the player, that's available as:
 
+
<pre>model = import('Game').player.model</pre>
<pre>model = Game.player.model</pre>
 
  
 
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:
 
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:
 
+
<pre>model = import('Game').player:GetNavTarget().model
<pre>model = Game.player:GetNavTarget().model
+
model = import('Game').player:GetCombatTarget().model</pre>
model = Game.player:GetCombatTarget().model</pre>
 
  
 
== Set debug flags ==
 
== Set debug flags ==
  
 
Once you've got a model reference, pass a list of the flags you want to enable to its <code>SetDebugFlags()</code> method:
 
Once you've got a model reference, pass a list of the flags you want to enable to its <code>SetDebugFlags()</code> method:
 
 
<pre>model:SetDebugFlags({"BBOX","COLLMESH"})</pre>
 
<pre>model:SetDebugFlags({"BBOX","COLLMESH"})</pre>
  
 
To disable all flags, pass an empty list:
 
To disable all flags, pass an empty list:
 
 
<pre>model:SetDebugFlags({})</pre>
 
<pre>model:SetDebugFlags({})</pre>
  
Line 28: Line 24:
 
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.
 
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.
  
[[File:Model-debug-bbox.png|800x500px]]
+
[[File:Model-debug-bbox.png|800x500px|Model-debug-bbox.png]]
  
 
=== COLLMESH - Collision mesh ===
 
=== COLLMESH - Collision mesh ===
Line 34: Line 30:
 
Displays the collision mesh of the model. Also shows special collision-based surfaces (such as docking surfaces).
 
Displays the collision mesh of the model. Also shows special collision-based surfaces (such as docking surfaces).
  
[[File:Model-debug-collmesh.png|800x500px]]
+
[[File:Model-debug-collmesh.png|800x500px|Model-debug-collmesh.png]]
  
[[File:Model-debug-collmesh-station.png|800x500px]]
+
[[File:Model-debug-collmesh-station.png|800x500px|Model-debug-collmesh-station.png]]
  
 
=== WIREFRAME - Wireframe mode ===
 
=== WIREFRAME - Wireframe mode ===
Line 42: Line 38:
 
Draws the model in wireframe. This can result in a performance hit on complex modes.
 
Draws the model in wireframe. This can result in a performance hit on complex modes.
  
[[File:Model-debug-wireframe.png|800x500px]]
+
[[File:Model-debug-wireframe.png|800x500px|Model-debug-wireframe.png]]
  
 
=== TAGS - Show model tags ===
 
=== TAGS - Show model tags ===
Line 48: Line 44:
 
Draws an axis indicator at any <tt>tag_</tt> points defined on the model.
 
Draws an axis indicator at any <tt>tag_</tt> points defined on the model.
  
[[File:Model-debug-tags.png|800x500px]]
+
[[File:Model-debug-tags.png|800x500px|Model-debug-tags.png]]
  
 
=== DOCKING - Show docking positions ===
 
=== DOCKING - Show docking positions ===
Line 54: Line 50:
 
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.
 
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.
  
[[File:Model-debug-docking-station.png|800x500px]]
+
[[File:Model-debug-docking-station.png|800x500px|Model-debug-docking-station.png]]

Latest revision as of 19:04, 27 December 2016

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