Player API: Animation-dependent collisionbox and eye_height #2743
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2742
See #2742 (comment) and following comments.
For the registered MTG player model, collisionbox and eye-height will now be correctly set when 'sitting' or 'laying'.
The main benefit however is for mod-registered player models and their various and possibly more unusual animations, for example a crawling animation could now allow a player to pass through 1-node high spaces.
Player model collisionbox and eye_height can each be defined as a table of per-animation values, or left as a single universal value (which also ensures backwards compatibility).
When animation is set in
set_animation()
, the animation-dependent object properties are also set.The
set_animation()
function returns if the requested animation is already applied to a player, so the function only executes when the animation needs to change, for example starting walking, stopping walking etc.Now that object properties are also set in
set_animation()
, an object properties packet is sent to the client each time animation changes. I hope this is not a significant increase in network traffic, as it will be on average 1 extra packet every second (very approximately).