This is an odd situation, but my goal is to get the transformation of a bone of minecraft:player in a way where it is defined in a variable that overrides the player's molang variables for me to access. I've tried straight up overriding a variable in pre_animation, but molang complained about not finding a queryable bone. The next thing I tried was to define it in attachments and then reference it, but molang still complained about not finding a bone and that a variable was undefined.
#Using q.bone_orientation_trs to define a variable inside the player's molang variables
1 messages ยท Page 1 of 1 (latest)
The end goal is to have a variable defined by the player to be a pointer to the bone's transformation, since in my case I can only access the player's molang variables.
I have not tried temp leaking yet.
That query alongside others dont really work well in the player file from my testing.
so is it just impossible to override any of those variables in pre_animation or any of the player's molang variables to the bone's x rotation?
I was hoping there was some loophole where an environment that allows that query makes it doable
Oh wait sorry #1067870133328027730 message this is the wrokariund I used.
I was thinking of the locator molang, apologies.
is it this that you are referencing? #1374919410979962941 message
Yes.
thank you, ill try it
Seems to give me the same error: ```
[Molang][error]-minecraft:player.0.aaaaaaaa-7b21-4637-9b63-8ad63622ef01.8dcf7264-3d21-45ac-9693-ad89f05c0198 | entity/player.entity.json | v.is_rendered ? {v.rightarm = q.bone_orientation_trs('rightarm'); v.map_angle = v.rightarm.r.x;};v.is_rendered = true;variable.helmet_layer_visible = !query.has_head_gear;variable.leg_layer_visible = 1.0;variable.boot_layer_visible = 1.0;variable.chest_layer_visible = 1.0;variable.attack_body_rot_y = math.sin(360*math.sqrt(variable.attack_time)) * 5.0;variable.tcos0 = (math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;variable.first_person_rotation_factor = math.sin((1 - variable.attack_time) * 180.0);variable.hand_bob = query.life_time < 0.01 ? 0.0 : variable.hand_bob + ((query.is_on_ground && query.is_alive ? math.clamp(math.sqrt(math.pow(query.position_delta(0), 2.0) + math.pow(query.position_delta(2), 2.0)), 0.0, 0.1) : 0.0) - variable.hand_bob) * 0.02;variable.map_angle = math.clamp(1 - variable.player_x_rotation / 45.1, 0.0, 1.0);variable.item_use_normalized = query.main_hand_item_use_duration / query.main_hand_item_max_duration;variable.riding_y_offset = query.is_riding_any_entity_of_type('minecraft:minecart', 'minecraft:boat', 'minecraft:chest_boat', 'minecraft:strider') ? -3.0 : 0.0; | query.bone_orientation_trs couldn't find the specified bone in the current entity's queryable geometry.
@fathom crypt im just going to ping you here since it was your method, wondering if you could help as well
initialize
"v.trs_struct.t.x = 0; v.trs_struct.t.y = 0; v.trs_struct.t.z = 0;",
"v.trs_struct.r.x = 0; v.trs_struct.r.y = 0; v.trs_struct.r.z = 0;",
"v.trs_struct.s.x = 0; v.trs_struct.s.y = 0; v.trs_struct.s.z = 0;",
"v.body = v.trs_struct;",
"v.is_rendered = false;"
pre anim
"v.is_rendered ? {v.body = q.bone_orientation_trs('rightItem');};",
"v.is_rendered = true;",
This is what I had.
I also had this
"variables": {
"variable.body": "public"
},
Oh I see, you need to move the v.map_angle after setting rendered to true.
where should I move it?
Right after v.is_rendered=true;
So in your case.
"v.is_rendered ? {v.rightarm = q.bone_orientation_trs('rightarm');};",
"v.is_rendered = true;",
v.map_angle = v.rightarm.r.x;
okay ill try that
also added the public variable
same story, same error
ill try to copy what you had exactly
Can you do rightItem instead?
sure ill try that
Now I unfortunately cannot share the full code I had working since it's NDA. However, I did use
v.offset_x=c.owning_entity->v.body.t.x;
v.offset_y=c.owning_entity->v.body.t.y;
v.offset_z=c.owning_entity->v.body.t.z;
``` in an animation file.
"initialize": [
"variable.is_holding_right = 0.0;",
"variable.is_blinking = 0.0;",
"variable.last_blink_time = 0.0;",
"variable.hand_bob = 0.0;",
"v.trs_struct.t.x = 0; v.trs_struct.t.y = 0; v.trs_struct.t.z = 0;",
"v.trs_struct.r.x = 0; v.trs_struct.r.y = 0; v.trs_struct.r.z = 0;",
"v.trs_struct.s.x = 0; v.trs_struct.s.y = 0; v.trs_struct.s.z = 0;",
"v.body = v.trs_struct;",
"v.is_rendered = false;"
],
"pre_animation": [
"variable.helmet_layer_visible = !query.has_head_gear;",
"variable.leg_layer_visible = 1.0;",
"variable.boot_layer_visible = 1.0;",
"variable.chest_layer_visible = 1.0;",
"variable.attack_body_rot_y = Math.sin(360*Math.sqrt(variable.attack_time)) * 5.0;",
"variable.tcos0 = (math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;",
"variable.first_person_rotation_factor = math.sin((1 - variable.attack_time) * 180.0);",
"variable.hand_bob = query.life_time < 0.01 ? 0.0 : variable.hand_bob + ((query.is_on_ground && query.is_alive ? math.clamp(math.sqrt(math.pow(query.position_delta(0), 2.0) + math.pow(query.position_delta(2), 2.0)), 0.0, 0.1) : 0.0) - variable.hand_bob) * 0.02;",
"variable.map_angle = math.clamp(1 - variable.player_x_rotation / 45.1, 0.0, 1.0);",
"variable.item_use_normalized = query.main_hand_item_use_duration / query.main_hand_item_max_duration;",
"variable.riding_y_offset = query.is_riding_any_entity_of_type('minecraft:minecart', 'minecraft:boat', 'minecraft:chest_boat', 'minecraft:strider') ? -3.0 : 0.0;",
"v.is_rendered ? {v.body = q.bone_orientation_trs('rightItem');};",
"v.is_rendered = true;"
],
v.is_rendered ? {v.body = q.bone_orientation_trs('rightitem');};v.is_rendered = true; | query.bone_orientation_trs couldn't find the specified bone in the current entity's queryable geometry.
``` again same error
That's so weird, I wonder if adding "min_engine_version": "1.12.0", works. That's the only difference I have that your file doesn't.
I put it under the identifier
yeah no its still erroring, so weird
do you think that I should like include the humanoid_custom.geo file in my resource pack or
change it somehow
interestingly when using it on a pig nothing errors
I copied everything exactly, so should I just like edit the humanoid_custom geometry metadata or something to match the pig?
Ok, so neither of us were crazy, just Mojang moment ๐
Can you copy pase the current model that vanilla uses but change the id and make your player entity use that new model?
do i change this?
Yeah, I would copy the vanilla model into your pack, change the id and make the player use that.
i made it geometry.custom_model.player, what should I set the filename?
custom_model.player.geo?
After all of that including changing the identifiers, filename, geometry, etc, it still errors saying the bone isnt found
resource packs really are very particular in what they want
That's so weird :/ everything looks the same. @rocky badge , what if you made the player use the pig model instead?
ill try that i guess
tried that and edited this, all it did was change my skin to steve, break my animations, and give the same error
Try it on a non-player entity, to eliminate the possibility of it being broken specifically for players. Also, sometimes you have to wait longer than 1 frame for that query to work, so content log is not an indication that it's not working. You can also add "queryable_geometry": "default" to change which geo that query operates on, but it should be default by default. Also query.bone_orientation_trs(...).r.x stuff like this doesn't work and you have to set it to a variable and only then extract struct members v.example = query.bone_orientation_trs(...); t.foo = v.example.r.x;
Try it on a non-player entity, to eliminate the possibility of it being broken specifically for players
@rocky badge did try it on a pig entity, and it did not throw errors.
It may be that the player model is overwritten or changed a few ticks after loading, with all the persona skin shenanigans.
I've made it work for a player attachable, but I have forgotten about on the player entity directly, I'll see if I get the same issue.
Also query.bone_orientation_trs(...).r.x stuff like this doesn't work and you have to set it to a variable and only then extract struct members
๐ true
The error was coming from the paperdoll/UI player.
Use "v.has_rendered && !q.is_in_ui && !v.is_paperdoll ? {v.test_rightitem = q.bone_orientation_trs('rightitem');};" to fix it.
Some hard-coded variables were also missing (the ones involving the new spear animations), causing other errors, I quickly initialized them just to make them go away, but I have not looked into what values they should have, so the first person attack animation will look wonky with the following: