stujones11 / shooter

First Person Shooter Mod for Minetest
Other
30 stars 18 forks source link

Use eye_height player property instead of hard-coded value #31

Closed ClobberXD closed 5 years ago

ClobberXD commented 5 years ago

The camera height is hard-coded and is set to 1.5. I think it's better to use the player property field eye_height. There are at least two benefits:

stujones11 commented 5 years ago

I did actually consider this, however, the default value of 1.625 does not seem to work well for either the raycast origin or the bullet particles. I do intend to look into this further but a setting of 1.5 seems to work okay for now. This is a config option, so not completely hard-coded but I agree it would be best done on a per-player basis for the reasons you mention.

stujones11 commented 5 years ago

Well it turns out that 1.625 is just a documentation error, the true eye_height reported by the default player is in fact 1.47 which works as expected.

2a68881248aea59c20fa59847b198d636bd9c66b

ClobberXD commented 5 years ago

1.625 is indeed the engine default. But MTG overrides that value to a value of 1.47, starting from 5.0.0.

Thanks for addressing this issue. :)

stujones11 commented 5 years ago

1.625 is indeed the engine default.

Ah, that makes sense I guess, thanks for letting me know.

HybridDog commented 5 years ago

There's an additional eye_offset, which seems to be rarely used: https://github.com/minetest/minetest/blob/a4677496f347a3c9bd66b39ca535f8346bac1708/doc/lua_api.txt#L5380-L5384

ClobberXD commented 5 years ago

eye_offset is the property I initially kept confusing for eye-height. While it's not documented, the first and third fields (for first-person offset and third-person offset respectively) are nil unless they were set using set_eye_offset first.