Breakable objects

From The DarkMod Wiki
Revision as of 13:12, 8 February 2008 by Tels (talk | contribs) (move content of breakable bonds to sep. article)
Jump to navigationJump to search

Things to remember:

This article represents work-in-progress and does not necessarily reflect the current working state of the code!

Introduction

This article deals with details in regarding of breaking single objects apart in the physics simulation.

For breaking the connection between bound objects, please see the article about breakable bonds.

Destroying Objects

When the force acting on one entity becomes very strong, it should be destroyed. This can happen while the entity is still bound to another entity, or after they have become unbound. These cases are already working for some objects, like wine bottles.

Currently, this is done by setting the following spawnargs on one entity:

       "broken"                        "models/darkmod/junk/wbottle01_broken.lwo"
       "health"                        "20"

The Spawnarg:health sets the amount of damage that needs to be done to the object until it breaks, and the Spawnarg:broken sets the model that will replace the default model after the destruction.

Drawbacks of this method are that health can drop by small forces acting on the entity. After the health has dropped considerable, a small force can then suddenly break the object. For instance, damaging a wine bottle by 9 points 2 times would leave the bottle with only 2 points health, and thus suddenly a damage of 2 points can destroy the bottle.

Another drawback is that forces do not translate into damage except in some specially coded exceptions, like hits from weapons or movers that damage entities.

TODO

  • Except wine bottles, no object breaks when a sufficient force acts on it.
  • Strong forces do not nec. damage entities. For instance dropping a crate on a bottle does not break the bottle.
  • Damage needs to be calculated from the impulse, not from a fixed set of "damage" values.

See also