Codebase list minetest-mod-throwing / 49f3f36
Better documentation for new physics in README.md upsilon 4 years ago
1 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
3535
3636 By default, the trajectory of the arrow is a simple parabola. You can set the vertical acceleration (acceleration of gravity) using `throwing.vertical_acceleration`.
3737
38 If you want a more realistic trajectory that uses a first-order modelling of air friction, you can set `throwing.realistic_trajectory` to true. In this mode, `throwing.frictional_coefficient` indicates the ratio between the friction force on the arrow and its velocity. It should be negative. The acceleration of the arrow is subsequently determined by dividing the force by the "mass" of the arrow, the reference mass of 1 being the mass of a simple steel arrow. Generally, the frictional coefficient should be quite small; a value of -1 will already drastically shorten the range of the arrow. The default is -0.5.
38 If you want a more realistic trajectory that uses a first-order modelling of air friction, you can set `throwing.realistic_trajectory` to true. In this mode, `throwing.frictional_coefficient` indicates the ratio between the friction force on the arrow and its velocity. It should be negative. The acceleration of the arrow is subsequently determined by dividing the force by the "mass" of the arrow, the reference mass of 1 being the mass of the steel arrow in `throwing_arrows`. Generally, the frictional coefficient should be quite small; a value of -1 will already drastically shorten the range of the arrow. The default is -0.5.
3939
4040 ### Initial velocity computation
4141
42 The mod provides three modes to compute the initial speed of an arrow: simple, strength or strengthmass.
42 The mod provides three modes to compute the initial velocity of an arrow after it is shot: simple, strength and momentum.
4343
44 In simple mode, the initial velocity of the arrow is always the same. The `throwing.velocity_factor` contains the value of this velocity.
44 In simple mode, the initial velocity of the arrow is always the same. The value of this velocity is controlled by the `throwing.velocity_factor` setting, which defaults to 19.
4545
46 In strength mode (the default), the initial velocity of the arrow only depends on the bow that is used---the more expensive the bow, the faster the arrow. The arrow strength is multiplied by the velocity factor to compute the speed of the arrow, an arrow strength of 1 is about the strength of the steel bow in `throwing_arrows`.
46 In strength mode (the default), the initial velocity of the arrow only depends on the bow that is used---the more expensive the bow, the faster the arrow. The bow strength is multiplied by the velocity factor to compute the speed of the arrow. For reference, the steel bow in `throwing_arrows` has a strength of about 1.
4747
4848 Finally, momentum mode is the most realistic. It computes the velocity of the arrow based on the bow strength, as in the strength mode, and on the mass of the arrow: the heavier the arrow, the slower it will be shot. It is called the momentum mode because, in this mode, the strength of a bow indicates the initial momentum of the arrow rather than its initial speed.
4949
7575 * sound: sound to be played when the bow is used
7676 * delay: delay before throwing the arrow
7777 * no_toolranks: If true, toolranks support is disabled for this item. Defaults to false.
78 * strength: strength of the bow, see above. Defaults to 1.
7879 ]]
7980
8081 -- Example:
9293 * tiles (essential): tiles of the arrow.
9394 * target (optional, defaulting to throwing.target_both): what the arrow is able to hit (throwing.target_node, throwing.target_object, throwing.target_both).
9495 * allow_protected (optional, defaulting to false): whether the arrow can be throw in a protected area
96 * mass (optional, defaulting to 1): the mass of the arrow (see above)
9597 * on_hit_sound (optional): sound played when the arrow hits a node or an object.
9698 * on_hit(self, pos, last_pos, node, object, hitter, data) (optional but very useful): callback function:
9799 - pos: the position of the hit node or object.