No way to unset bone.
FatalError42O opened this issue · comments
(I accidentally closed this issue last time don't worry about it lol)
This is not only a feature a request, but to some extent a bug report.
When you use :set_bone_position() it is impossible to unset, reset, or otherwise return it to it's original state!
this means, (for example) if you want to make an arm face a certain direction (without permanently disabling animations in that bone) that you need to: change the player model to a model with BONES WITH SEPERATE NAMES and then set it back when you're done, there is no way around this, I've faced this problem time and time again, resetting the model does nothing, it is painful.
The clear solution is to add a equivalent objref:unset_bone_position() function, this way you can return the bone to its original state where it is animated according to the model.
There's also a few other ways to go about this;
have returning nil return it to its original state instead of adding a new function
OR
make an option to have it be an offset type thing like:
objref:set_bone_position([bone, position, rotation], offset)
where "offset" would be a bool indicating whether it removes the animation entirely, this would serve multiple purposes
it would
A: allow for more complex animations to be done with a bone (this is a massive improvement and would open up possibilities)
B: obviously allow it to be reverted back by objref:set_bone_position("arm_right", nil, nil, true) or something of the sort
While the addition to the set_bone_position by creating an option for it to be an offset is a great option, it is not exactly necessary at the moment, and may take more time to implement (though I'm not a core dev so I don't know) if minetest and its development was perfect, I'd choose that option, however for now- I think it can (hopefully) be a later addition to the API and can wait. What's more important is that there's actually a way to unset bone positions, as this is a absolutely frustrating issue, and needs to be improved desperately if the modding community is to continue innovating
Do you have a TESTING MOD, by any chance?
- Removing bones should be feasible by adding a flag to
AO_CMD_SET_BONE_POSITION
. - Animated bones (rotation) is trickier to get right.
scene::EJUOR_CONTROL
overrides the default animations to re-position bones. HenceGenericCAO::updateBonePosition()
must trigger the position and rotation calculations manually.
Considering API changes, I would suggest the following:
set_bone_position(bone, pos, nil)
animated rotation (if possible)set_bone_position(bone, nil[, nil])
undo bone attachment
I could make a testing mod, ill probably do that later- its rather simple to test if you just use commands to pass everything directly to function though
T think this would be a great feature. And definitely great for modders.
My API proposal:
player:set_bone_overrides(bone_override_table)
, wherebone_override_table = {[bonename] = override}
.override
can befalse
to clear an override or a table{position = vec or false or nil, rotation = vec or false or nil, scale = vec or false or nil}
-nil
values lead to a value being ignored whereasfalse
values clear properties.player:get_bone_overrides()
: returns said table (obviously no values arefalse
).player:set_bone_override(bonename, override)
: shorthand forplayer:set_bone_overrides{[bonename] = override}
player:get_bone_override(bonename)
: shorthand forplayer:get_bone_overrides()[bonename]
, mostly for perf
My API proposal:
player:set_bone_overrides(bone_override_table)
, wherebone_override_table = {[bonename] = override}
.override
can befalse
to clear an override or a table{position = vec or false or nil, rotation = vec or false or nil, scale = vec or false or nil}
-nil
values lead to a value being ignored whereasfalse
values clear properties.player:get_bone_overrides()
: returns said table (obviously no values arefalse
).player:set_bone_override(bonename, override)
: shorthand forplayer:set_bone_overrides{[bonename] = override}
player:get_bone_override(bonename)
: shorthand forplayer:get_bone_overrides()[bonename]
, mostly for perf
This would work, as long as backwards compat. would be preserved (atleast IMO)
more importantly, though, I think this new implementation should include scaling