MODELDEF

From ZDoom Wiki
Jump to: navigation, search
Center Warning: This feature does not work in ZDoom but in its OpenGL children ports.

MODELDEF is the lump which defines models used in hardware-accelerated ports.

Contents

Model Definition Overview

Models with named frames

MD2s normally have actual frame names so you can reference them by name.

Model <ActorName>
{
   Path <"path">
   Model <model index> <"model file">
   Skin <model index> <"skin file">
   Scale <X scale> <Y scale> <Z scale>

   Frame <XXXX> <X> <model index> <"frame name">
}

For models with unnamed frames

MD3s do not contain any useful names that you can use. You would use frame indexes instead of frame names. More information below.

Model <ActorName>
{
   Path <"path">
   Model <model index> <"model file">
   Skin <model index> <"skin file">
   Scale <X scale> <Y scale> <Z scale>

   FrameIndex <XXXX> <X> <model index> <frame number>
}

More detailed information

In the two above examples, <ActorName> is the name of the actor (as used in DECORATE, etc), <XXXX> is the sprite lump (example POSS), and <X> is the sprite frame (example A). The rest can be found in the Properties section.

Flags and Properties

Flags

There are a number of flags that you can use in MODELDEF.

  • PITCHFROMMOMENTUM
Adjusts the model's pitch to match the momentum of the actor; useful for rocket projectiles.
  • IGNORETRANSLATION
Ignores the actor's translation.
  • INTERPOLATEDOUBLEDFRAMES
Workaround to smooth the model interpolation of actors that use the same frame twice in a row. Most of the standard Doom monsters do this in their see state.
  • ROTATING
Makes the model rotate, useful for pickup models a la Quake 3.
  • NOINTERPOLATION
Forces uninterpolated animation.

Properties

  • Path path
Path to model file in the ZIP/PK3
  • Model model-index model-file
Defines model to use. You can define multiple models to use with different indexes.
  • Skin model-index skin-file
Defines skin to use for the model of the same index. The skin-file can be of any format that ZDoom supports.
  • Scale float float float
Defines the x, y, and z scaling of the model.
  • Rotation-Speed float
Specify the speed of the rotation. Without the ROTATING keyword, this and the other rotation properties do nothing
  • Rotation-Vector float float float
Specify the x, y and z component of the vector of the rotation
  • Rotation-Center float float float
Specify the x, y and z coordinate of the center of the rotation
  • ZOffset float
Adjusts the model's height, useful if you don't have access to a model editor.

Examples

Simple one-frame example:

Model SteelCrate
{
   Path "Models/Crate"
   Model 0 "Steelc.md2"
   Skin 0 "Steelc.png"

   Frame COL1 A 0 "frame01"
}

An example of a walking animation for an MD2 model (uses frame names instead of frame numbers):

Model BloodHound              // Name of actor in DECORATE
{
   Path "models/bloodhound"   // Path to model in PK3
   Model 0 "bloodhound.md2"   // Model index, model file
   Skin 0 "bloodhound.pcx"    // Model index, texture (can be in any format supported by GZDoom)
   Scale 1.0 1.0 1.0          // Scale values

   Frame BHND A 0 "walk01"    // The sprite lump, sprite frame, model index, name of frame
   Frame BHND B 0 "walk02"
   Frame BHND C 0 "walk03"
   Frame BHND D 0 "walk04"
}

An example of a walking animation for an MD3 model (uses frame numbers instead of frame names):

Model InsaneCancer               // Name of actor in DECORATE
{
   Path "models/insanecancer"    // Path to model in PK3
   Model 0 "insanecancer.md3"    // Model index, model file
   Skin 0 "insanecancer.png"     // Model index, texture (can be in any format supported by GZDoom)
   Scale 1.0 1.0 1.0             // Scale values

   FrameIndex ICNC A 0 0         // The sprite lump, sprite frame, model index, frame number
   FrameIndex ICNC B 0 1
   FrameIndex ICNC C 0 2
   FrameIndex ICNC D 0 3
}

Multiple model example:

Model MultiModel
{
   Path "Models/MyModel"
   Model 0 MyModel_Piece_1.md3
   Skin 0 MyModel_Piece_1.jpg
   Model 1 MyModel_Piece_2.md3
   Skin 1 MyModel_Piece_2.jpg
   Model 2 MyModel_Piece_3.md3
   Skin 2 MyModel_Piece_3.jpg
   Model 3 MyModel_Piece_4.md3
   Skin 3 MyModel_Piece_4.jpg

   Scale 1.0 1.0 1.0

   Frame FRAM A 0 0 // All four models are drawn when you call frame "FRAM A"
   Frame FRAM A 1 0
   Frame FRAM A 2 0
   Frame FRAM A 3 0
}

Notes

If you don't know how the frames in your model file are named, simply use FrameIndex instead of Frame. By using FrameIndex, all you have to do is supply the frame NUMBERS, without having to worry about typing out the frame names correctly.

Personal tools
Namespaces
Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox