1
0
mirror of https://github.com/Mojang/bedrock-samples.git synced 2025-10-25 19:44:15 +00:00
Files
bedrock-samples/resource_pack/animations/player_firstperson.animation.json
2025-10-14 08:54:35 -07:00

222 lines
12 KiB
JSON

{
"format_version": "1.8.0",
"animations": {
// Animates attachable items and the player arm if no item is equipped.
"animation.player.first_person.attack_rotation": {
"loop": true,
"bones": {
"rightarm": {
"position": [
"math.clamp(-15.5 * math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 112.0), -7.0, 999.0) * math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 112.0)",
"math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 200.0) * 7.5 - variable.first_person_item_rotation_factor * variable.attack_time * 15.0 + variable.short_arm_offset_right",
"math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 120.0) * 1.75"
],
"rotation": [
"math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 280.0) * -60.0",
"math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 280.0) * 40.0",
"math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 280.0) * 20.0"
]
}
}
},
// Animates attachable items and the player arm if no item is equipped... or maybe not, as commenting this out doesn't seem to have any effect.
"animation.player.first_person.attack_item_rotation": {
"loop": true,
"override_previous_animation": true,
"bones": {
"rightitem": {
"position": [
"-math.sin(math.sqrt(variable.attack_time) * Math.Pi * 100) * 10",
"math.sin(math.sqrt(variable.attack_time) * Math.Pi * 2 * 60) * 10",
"-math.sin(variable.attack_time * Math.Pi * 65) * 2"
],
"rotation": [
"-math.sin(math.sqrt(variable.attack_time) * Math.Pi * 20) * 25",
"-math.sin(math.sqrt(variable.attack_time) * 75.0) * 15.0",
"-math.sin(math.sqrt(variable.attack_time) * 25) * 15"
]
}
}
},
"animation.player.first_person.base_pose": {
"loop": true,
"bones": {
"body": {
"rotation": [ "query.target_x_rotation", "query.target_y_rotation", 0.0 ]
},
"head": {
"rotation": [ "query.target_x_rotation", "query.target_y_rotation + 180", 0.0 ]
}
}
},
"animation.player.first_person.crossbow_equipped": {
"loop": true,
"override_previous_animation": true,
"bones": {
"leftarm": {
"position": [ "1.5 - variable.item_use_normalized * 3.5", "-3.799999952316284 + variable.short_arm_offset_left", "8.25 - (1 - variable.item_use_normalized)" ],
"rotation": [ 165.0, -60.0, 45.0 ],
"scale": [ 0.4, 0.4, 0.4 ]
},
"rightitem": {
"position": [ 0.0, 2.0, "2.5 - query.item_remaining_use_duration('main_hand', 1.0) * 1.5" ],
"rotation": [ -20.0, -15.0, -30.0 ],
"scale": [ 1.0, "1.15 - query.item_remaining_use_duration('main_hand', 1.0) * 0.15", 1.0 ]
}
}
},
"animation.player.first_person.crossbow_hold": {
"loop": true,
"bones": {
"rightitem": {
"position": [ "query.get_equipped_item_name('off_hand') == 'shield' ? -4.0 : 0.0", 0.0, 0.0 ]
}
}
},
"animation.player.first_person.melee_spear_hold": {
"loop": true,
"override_previous_animation": false,
"bones": {
"rightitem": {
"position": [ -1.5, 2.0, 3.5 ],
"rotation": [ 45.0, 55.0, -12.5 ]
}
}
},
"animation.player.first_person.melee_spear_use": {
"loop": true,
"override_previous_animation": false,
"bones": {
"rightitem": {
"position": [ "-1.5 + v.fp_melee_spear_use_item_position_x", "2.0 + v.fp_melee_spear_use_item_position_y", "3.5 + v.fp_melee_spear_use_item_position_z" ],
"rotation": [ 45.0, "55.0 + v.fp_melee_spear_use_item_rotation_y", "-12.5 + v.fp_melee_spear_use_item_rotation_z" ]
}
}
},
"animation.player.first_person.melee_spear_attack": {
"loop": true,
"override_previous_animation": false,
"bones": {
"rightitem": {
"position": [ "-1.5 + v.fp_melee_spear_attack_item_position_x", "2.0 + v.fp_melee_spear_attack_item_position_y", "3.5 + v.fp_melee_spear_attack_item_position_z" ],
"rotation": [ 45.0, "55.0 + v.fp_melee_spear_attack_item_rotation_y", "-12.5 + v.fp_melee_spear_attack_item_rotation_z" ]
}
}
},
"animation.player.first_person.breathing_bob": {
"loop": true,
"override_previous_animation": false,
"bones": {
"rightitem": {
"position": [ 0.0, "variable.bob_animation * math.sin(q.life_time * 45.0) * 0.5", 0.0 ]
}
}
},
// This animation defines the base pose even when the player is carrying an item.
"animation.player.first_person.empty_hand": {
"loop": true,
"bones": {
"rightarm": {
"position": [ 13.5, -10.0, 12.0 ],
"rotation": [ "95.0 + variable.is_using_vr * 7.5", "-45.0 + variable.is_using_vr * 7.5", "115.0 + variable.is_using_vr * -2.5" ]
},
"rightitem": {
"position": [ 0.0, "q.get_default_bone_pivot('rightarm',1) - q.get_default_bone_pivot('rightitem',1) - 7.0", "-q.get_default_bone_pivot('rightitem',2)" ]
},
"leftitem": {
"position": [ 0.0, "q.get_default_bone_pivot('leftarm',1) - q.get_default_bone_pivot('leftitem',1) - 7.0", "-q.get_default_bone_pivot('leftitem',2)" ]
}
}
},
"animation.player.first_person.map_hold": {
"loop": true,
"bones": {
"leftarm": {
"position": [ "-16.250 + variable.is_vertical_splitscreen * 7.0", "-10.75 - variable.map_angle * 8.0 + variable.is_vertical_splitscreen * 0.6 - variable.short_arm_offset_left", "9.0 - variable.map_angle * 8.0 + variable.short_arm_offset_left" ],
"rotation": [ 40.0, -20.0, -155.0 ],
"scale": [ 1.15, 1.15, 1.15 ]
},
"rightarm": {
"position": [ "12.50 + variable.is_vertical_splitscreen * 1.75", "-7.5 - variable.map_angle * 8.0 + variable.is_vertical_splitscreen * 0.5 - variable.short_arm_offset_right", "5.25 - variable.map_angle * 8.0 + variable.short_arm_offset_right" ],
"rotation": [ 77.5, 7.5, 160.0 ]
}
}
},
"animation.player.first_person.map_hold_attack": {
"loop": true,
"bones": {
"leftarm": {
"position": [ "math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 112.0) * -10.75", "math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 200.0) * 3.75 - variable.first_person_item_rotation_factor * variable.attack_time * 1.25 + variable.short_arm_offset_left", "math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 120.0) * 5.75" ],
"rotation": [ "variable.map_angle * 90.0", "-15.0 * math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * -100.0)", 0.0 ]
},
"rightarm": {
"position": [ "math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 112.0) * -6.25", "math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 200.0) * 1.75 + variable.short_arm_offset_right", "math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 120.0) * 5.25" ],
"rotation": [ "variable.map_angle * 90.0", 0.0, 0.0 ]
}
}
},
"animation.player.first_person.map_hold_main_hand": {
"loop": true,
"bones": {
"rightarm": {
"position": [ "14.50 - variable.is_vertical_splitscreen * 0.75", "-8.25 + variable.short_arm_offset_right + math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 200.0) * 2.75 - variable.first_person_item_rotation_factor * variable.attack_time * 3.0 - variable.is_horizontal_splitscreen", "11.5 + math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 120.0) * 3.5 + variable.is_horizontal_splitscreen * 3.5" ],
"rotation": [ 195.0, 182.5, -5.0 ],
"scale": [ 0.75, 0.75, 0.75 ]
}
}
},
"animation.player.first_person.map_hold_off_hand": {
"loop": true,
"bones": {
"leftarm": {
"position": [ "-14.50 + variable.is_horizontal_splitscreen * 2.0 + variable.is_vertical_splitscreen * 8.7", "-8.250 + variable.short_arm_offset_left", "11.50 + variable.is_horizontal_splitscreen * 0.5" ],
"rotation": [ 195.0, 182.5, 2.5 ],
"scale": [ 0.75, 0.75, 0.75 ]
}
}
},
"animation.player.first_person.swap_item": {
"loop": true,
"bones": {
"leftarm": {
"position": [ 0.0, "(query.get_equipped_item_name('off_hand') == 'filled_map' || query.get_equipped_item_name('off_hand') == 'shield') ? 0.0 : -10.0 * (1.0 - context.player_offhand_arm_height)", 0.0 ]
},
"rightarm": {
"position": [ 0.0, "-10.0 * (1.0 - variable.player_arm_height)", 0.0 ]
}
}
},
"animation.player.first_person.shield_block": {
"loop": true,
"bones": {
"leftarm": {
"position": [ 0.0, "-10.0 * (1.0 - context.player_offhand_arm_height)", 0.0 ]
},
"rightarm": {
"position": [ 0.0, "query.get_equipped_item_name('off_hand') != 'shield' ? -10.0 * (1.0 - variable.player_arm_height) : 0.0", 0.0 ]
}
}
},
"animation.player.first_person.vr_attack_rotation": {
"loop": true,
"bones": {
"rightarm": {
"position": [ "5.0 * math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 112.0)", "(math.sin(variable.first_person_item_rotation_factor * (1.0 - variable.attack_time) * (1.0 - variable.attack_time) * 200.0) - 0.8) * 8.75 + 5.0", "math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 120.0) * 15.0" ],
"rotation": [ "30.7 * math.sin(variable.first_person_item_rotation_factor * variable.attack_time * -180.0 - 45.0) * 1.5", 0.0, "21.8 * math.sin(variable.first_person_item_rotation_factor * variable.attack_time * 200.0 + 30.0) * 1.25" ]
}
}
},
"animation.player.first_person.walk": {
"loop": true,
"bones": {
"leftarm": {
"position": [ "math.sin(-query.walk_distance * 180.0) * variable.hand_bob * 9.75", "-math.abs(math.cos(-query.walk_distance * 180.0)) * variable.hand_bob * 15.0 + variable.short_arm_offset_left", 0.0 ]
},
"rightarm": {
"position": [ "math.sin(-query.walk_distance * 180.0) * variable.hand_bob * 9.75", "-math.abs(math.cos(-query.walk_distance * 180.0)) * variable.hand_bob * 15.0 + variable.short_arm_offset_right", 0.0 ]
}
}
}
}
}