Moveables

From The DarkMod Wiki
Revision as of 18:06, 30 August 2008 by Greebo (talk | contribs) (added link to Pushing article)
Jump to navigationJump to search

Originally written by SneaksieDave & Ishtvan on http://forums.thedarkmod.com/topic/3968

Physics fans rejoice! If you want an object to be moveable (pick up and carry, push, float, shoot, etc.), even though it wasn't designed to be used that way, there is a way to do it anyway, and all within the editor.

In summary you need to create the model, make it moveable, and make sure a collision model exists for it...

Create a Moveable Model

  1. Create a brush, convert it to a moveable_base entity, and assign it the model you want to use.
  2. You only need one collision model file no matter how many instances of this moveable you make in your map so check if it has already been created (a .cm file of the same name as the model and in the same folder.) If not..

Create a Collision Model (CM)

In DoomEd:

  1. Drag a new temporary brush over the model, roughly covering it. This will be the collision hull, so get it as close as you can.
  2. Clip the shape if necessary, or convert it eg, to pyramid or whatever to best fit the model.
  3. Convert that brush to func_clipmodel.
  4. Check the origin of the brush entity is in the same place as the model's origin because that is where its origin will be in-game.
  5. Texture it with common/collision.
  6. With that brush still selected, do Selected->Export->To CM. Locate the model for which it will stand as a clipmodel, and save with the same name. The path and name are vital. Don't worry, DoomEd will automatically name it .cm instead by of your model's extension, so it shouldn't overwrite anything.
  7. You can now delete the temporary collision model brush entity.


In DarkRadiant:

  1. Important: Make sure the model is not rotated in any way.
  2. Drag a new temporary brush over the model, roughly covering it.
  3. Clip the shape if necessary, or convert it eg, to pyramid or whatever to best fit the model.
  4. Any texture will do on any surface.
  5. Convert to func_static (any entity will do)
  6. Check the origin of the brush entity is in the same place as the model's origin because that is where its origin will be in-game. If they do not coincide then either move the brush so it coincides and resize the brush or key V and drag the origin into position.
  7. Use the Edit -> Create CollisionModel from selection menu entry:
  8. The model selector dialog appears, Select the correct model. Click Click the OK button.
  9. A .cm should have now been saved in the same folder as the model and with the same name as the model.
  10. You can now delete the temporary collision model brush entity.

That's it. If you're working in the same map you can continue. There's no need to restart.

Complete List of Default Key/Values for Moveable entities

"Moveable object. Will drop to the floor and rest until activated."
"The visual model set with the 'model' key can also be used for"
"collision detection. However the model may not be too complex."
"max vertices = 32"
"max edges = 32"
"max polygons = 16"
""max edges per polygon = 16"
"The collision model must be an enclosed hull. Dangling polygons or"
"edges are not allowed. If the visual model is too complex or does"
"not meet these requirements it can be contained in a less complex"
"model for collision detection. Such a collision model is specified with the"
"'clipmodel' key."

"editor_var density"          "Volume of the object times the density is the mass."
"editor_var friction"         "Friction with contacting surfaces in the range [0-1] where 0 is no friction."
"editor_var bouncyness"       "How much the object bounces in the range [0-1] where 0 is no bounce."

"editor_var mass"             "Mass of the object (overrides density)."

"editor_model clipmodel"      "Model to be used for collision detection."
"editor_var clipshrink"       "Shrink the visual model with an epsilon and use it as a clip model."
"editor_var allowStep"        "Set to 0 to prevent monsters from ever walking over this object."
"editor_var nonsolid"         "Make the object non-solid."

"editor_bool nodrop"          "Do not drop to the floor."
"editor_bool noimpact"        "Do not activate by the impact of other objects."
"editor_bool notpushable"     "Do not allow to be pushed."

"editor_bool unbindondeath"   "Unbind entity when health drops down to or below zero."

"editor_var health"           "If set the visual model changes to 'broken' when the health drops down to or below zero."

"editor_model broken"         "Visual model to be used when the health drops down to or below zero."
"editor_bool explode"         "If set to 1 the moveable explodes and is removed when the health drops down to or below zero."

"editor_var init_velocity"    "Initial linear velocity set when activated."
"editor_var init_avelocity"   "Initial angular velocity set when activated."

"editor_var init_velocityDelay"   "Delay in seconds before the initial linear velocity is set after being activated."
"editor_var init_avelocityDelay"  "Delay in seconds before the initial angular velocity is set after being activated."

"editor_var initialSplineTime"    "Number of milliseconds the moveable should follow the initial spline path."

"editor_var damage"               "Damage definition if it damages things it collides with"
"editor_var damageWhenActive"     "Only damage when active ( currently for the vagary and influence stuff )"

"editor_var fx_collide"           "FX system to start at impact position when object collides."

Default Settings

"density"           "0.5"
"friction"          "0.05"
"bouncyness"        "0.6"
"explode"           "0"
"unbindondeath"     "0"
"health"            "0"
"nodrop"            "0"
"noimpact"          "0"
"notPushable"       "0"
"clipshrink"        "0"
"allowStep"         "1"
"snd_bounce"        "smallpanel_impact "

See also