Skip to content

Commit 8c2621a

Browse files
committed
✨ Add buttery smooth camera rotations to 1.21.4 and above.
1 parent 2553302 commit 8c2621a

8 files changed

Lines changed: 151 additions & 8 deletions

File tree

src/systems/datapackCompiler/1.21.2/animation.mcb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ dir root {
130130
positioned ^$(px) ^$(py) ^$(pz) \
131131
rotated ~$(ry) ~$(rx) \
132132
run tp @s ~ ~ ~ ~ ~
133+
# Precise Rotation Workaround. Fixes MC-272913.
134+
# Thanks @Triton365! (https://discord.com/channels/154777837382008833/157097006500806656/1402253905408163842)
135+
$execute \
136+
as $(uuid) \
137+
store success entity @s OnGround byte 1 \
138+
store success score @s <%OBJECTIVES.I()%> \
139+
unless score @s <%OBJECTIVES.I()%> matches 1
133140
}
134141
}
135142
}

src/systems/datapackCompiler/1.21.4/animation.mcb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ dir root {
130130
positioned ^$(px) ^$(py) ^$(pz) \
131131
rotated ~$(ry) ~$(rx) \
132132
run tp @s ~ ~ ~ ~ ~
133+
# Precise Rotation Workaround. Fixes MC-272913.
134+
# Thanks @Triton365! (https://discord.com/channels/154777837382008833/157097006500806656/1402253905408163842)
135+
$execute \
136+
as $(uuid) \
137+
store success entity @s OnGround byte 1 \
138+
store success score @s <%OBJECTIVES.I()%> \
139+
unless score @s <%OBJECTIVES.I()%> matches 1
133140
}
134141
}
135142
}

test-packs/1.20.4/blueprints/armor_stand_1.20.4.ajblueprint

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format": "animated-java:format/blueprint",
4-
"format_version": "1.8.0-beta.2",
4+
"format_version": "1.8.1",
55
"uuid": "167b27cd-b559-3f13-a97c-0841fe21f1d1",
66
"save_location": "D:\\github-repos\\animated-java\\old-animated-java\\test-packs\\1.20.4\\blueprints\\armor_stand_1.20.4.ajblueprint",
77
"last_used_export_namespace": "armor_stand"
@@ -2089,7 +2089,7 @@
20892089
"override": false,
20902090
"length": 1,
20912091
"snapping": 20,
2092-
"selected": true,
2092+
"selected": false,
20932093
"saved": true,
20942094
"path": "",
20952095
"anim_time_update": "",
@@ -2298,6 +2298,61 @@
22982298
]
22992299
}
23002300
}
2301+
},
2302+
{
2303+
"uuid": "7369e950-97e5-3a18-7b5a-f0369a42cdb4",
2304+
"name": "camera_test",
2305+
"loop": "loop",
2306+
"override": false,
2307+
"length": 120,
2308+
"snapping": 20,
2309+
"selected": true,
2310+
"saved": true,
2311+
"path": "",
2312+
"anim_time_update": "",
2313+
"blend_weight": "",
2314+
"start_delay": "",
2315+
"loop_delay": "0",
2316+
"excluded_nodes": [],
2317+
"animators": {
2318+
"808e3c26-7285-af3f-a079-d8b899176dd3": {
2319+
"name": "head",
2320+
"type": "bone",
2321+
"keyframes": [
2322+
{
2323+
"channel": "rotation",
2324+
"data_points": [
2325+
{
2326+
"x": "0",
2327+
"y": "0",
2328+
"z": "0"
2329+
}
2330+
],
2331+
"uuid": "d724507d-0fc4-e256-2dec-90ab2497fcb7",
2332+
"time": 0,
2333+
"color": -1,
2334+
"interpolation": "linear",
2335+
"easing": "linear",
2336+
"easingArgs": []
2337+
},
2338+
{
2339+
"channel": "rotation",
2340+
"data_points": [
2341+
{
2342+
"x": "0",
2343+
"y": "360",
2344+
"z": "0"
2345+
}
2346+
],
2347+
"uuid": "414a86e8-4127-88a3-551c-ec015f01ba8a",
2348+
"time": 120,
2349+
"color": -1,
2350+
"interpolation": "linear",
2351+
"easing": "linear"
2352+
}
2353+
]
2354+
}
2355+
}
23012356
}
23022357
],
23032358
"animation_variable_placeholders": "v.walk_speed = 360 * 1;\nv.run_speed = 360 * 1.5;\nv.stickbug_speed = 360 * 1.25;\n"

test-packs/1.20.4/blueprints/armor_stand_minimal_1.20.4.ajblueprint

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format": "animated-java:format/blueprint",
4-
"format_version": "1.8.0",
4+
"format_version": "1.8.1",
55
"uuid": "173aa82f-fb4f-c354-ad34-a34d7fbce647",
66
"save_location": "D:\\github-repos\\animated-java\\old-animated-java\\test-packs\\1.20.4\\blueprints\\armor_stand_minimal_1.20.4.ajblueprint",
77
"last_used_export_namespace": "armor_stand_minimal"
@@ -447,6 +447,7 @@
447447
"name": "root",
448448
"origin": [0, 0, 0],
449449
"color": 0,
450+
"onSummonFunction": "",
450451
"configs": {
451452
"default": {
452453
"billboard": "fixed",
@@ -476,6 +477,7 @@
476477
"name": "baseplate_root",
477478
"origin": [0, 0, 0],
478479
"color": 0,
480+
"onSummonFunction": "",
479481
"configs": {
480482
"default": {
481483
"billboard": "fixed",
@@ -505,6 +507,7 @@
505507
"name": "baseplate_pivot_a",
506508
"origin": [0, 1, 6],
507509
"color": 0,
510+
"onSummonFunction": "",
508511
"configs": {
509512
"default": {
510513
"billboard": "fixed",
@@ -537,6 +540,7 @@
537540
"name": "armor_stand_root",
538541
"origin": [0, 1, 0],
539542
"color": 0,
543+
"onSummonFunction": "",
540544
"configs": {
541545
"default": {
542546
"billboard": "fixed",
@@ -567,6 +571,7 @@
567571
"name": "waist_pivot",
568572
"origin": [0, 12, 0],
569573
"color": 0,
574+
"onSummonFunction": "",
570575
"configs": {
571576
"default": {
572577
"billboard": "fixed",
@@ -599,6 +604,7 @@
599604
"name": "body_waist_pivot",
600605
"origin": [0, 12, 0],
601606
"color": 0,
607+
"onSummonFunction": "",
602608
"configs": {
603609
"default": {
604610
"billboard": "fixed",
@@ -631,6 +637,7 @@
631637
"name": "body",
632638
"origin": [0, 24, 0],
633639
"color": 0,
640+
"onSummonFunction": "",
634641
"configs": {
635642
"default": {
636643
"billboard": "fixed",
@@ -696,6 +703,7 @@
696703
"name": "head",
697704
"origin": [0, 23, 0],
698705
"color": 0,
706+
"onSummonFunction": "",
699707
"configs": {
700708
"default": {
701709
"billboard": "fixed",
@@ -744,6 +752,7 @@
744752
"name": "left_arm",
745753
"origin": [-6, 23, 0],
746754
"color": 0,
755+
"onSummonFunction": "",
747756
"configs": {
748757
"default": {
749758
"billboard": "fixed",
@@ -792,6 +801,7 @@
792801
"name": "right_arm",
793802
"origin": [6, 23, 0],
794803
"color": 0,
804+
"onSummonFunction": "",
795805
"configs": {
796806
"default": {
797807
"billboard": "fixed",
@@ -844,6 +854,7 @@
844854
"name": "left_leg",
845855
"origin": [2, 12, 0],
846856
"color": 0,
857+
"onSummonFunction": "",
847858
"configs": {
848859
"default": {
849860
"billboard": "fixed",
@@ -890,6 +901,7 @@
890901
"name": "right_leg",
891902
"origin": [-2, 12, 0],
892903
"color": 0,
904+
"onSummonFunction": "",
893905
"configs": {
894906
"default": {
895907
"billboard": "fixed",

test-packs/latest/blueprints/armor_stand_latest.ajblueprint

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format": "animated-java:format/blueprint",
4-
"format_version": "1.8.0-beta.4",
4+
"format_version": "1.8.1",
55
"uuid": "167b27cd-b559-3f13-a97c-0841fe21f1d1",
66
"save_location": "D:\\github-repos\\animated-java\\old-animated-java\\test-packs\\latest\\blueprints\\armor_stand_latest.ajblueprint",
77
"last_used_export_namespace": "armor_stand"
@@ -17,7 +17,6 @@
1717
"data_pack": "../datapacks/animated_java",
1818
"on_summon_function": "say On-Summon!",
1919
"on_remove_function": "say On-Remove!",
20-
"auto_update_rig_orientation": false,
2120
"baked_animations": false,
2221
"json_file": "../testPluginExport.json"
2322
},
@@ -2089,7 +2088,7 @@
20892088
"override": false,
20902089
"length": 1,
20912090
"snapping": 20,
2092-
"selected": true,
2091+
"selected": false,
20932092
"saved": true,
20942093
"path": "",
20952094
"anim_time_update": "",
@@ -2298,6 +2297,62 @@
22982297
]
22992298
}
23002299
}
2300+
},
2301+
{
2302+
"uuid": "8b5ebbc6-1189-bb9a-00f6-6ef68e212fc1",
2303+
"name": "camera_test",
2304+
"loop": "loop",
2305+
"override": false,
2306+
"length": 90,
2307+
"snapping": 20,
2308+
"selected": true,
2309+
"saved": true,
2310+
"path": "",
2311+
"anim_time_update": "",
2312+
"blend_weight": "",
2313+
"start_delay": "",
2314+
"loop_delay": "0",
2315+
"excluded_nodes": [],
2316+
"animators": {
2317+
"3ffeee76-901e-f8a2-c29a-82f90e16fd1e": {
2318+
"name": "camera",
2319+
"type": "camera",
2320+
"keyframes": [
2321+
{
2322+
"channel": "position",
2323+
"data_points": [
2324+
{
2325+
"x": "math.sin(q.life_time * 4) * 100",
2326+
"y": "0",
2327+
"z": "math.cos(q.life_time * 4) * 100"
2328+
}
2329+
],
2330+
"uuid": "7ea87827-b1e4-6f50-5a62-b4a2b3e25b54",
2331+
"time": 0,
2332+
"color": -1,
2333+
"interpolation": "linear",
2334+
"easing": "linear",
2335+
"easingArgs": []
2336+
},
2337+
{
2338+
"channel": "rotation",
2339+
"data_points": [
2340+
{
2341+
"x": "0",
2342+
"y": "q.life_time * 4",
2343+
"z": "0"
2344+
}
2345+
],
2346+
"uuid": "3e52691f-2314-0f11-1f4f-d6ce872df516",
2347+
"time": 0,
2348+
"color": -1,
2349+
"interpolation": "linear",
2350+
"easing": "linear",
2351+
"easingArgs": []
2352+
}
2353+
]
2354+
}
2355+
}
23012356
}
23022357
],
23032358
"animation_variable_placeholders": "v.walk_speed = 360 * 1;\nv.run_speed = 360 * 1.5;\nv.stickbug_speed = 360 * 1.25;\n"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"pack": {
33
"description": "AJ Testing DP",
4-
"min_format": 88,
4+
"min_format": 93.1,
55
"max_format": 9999999
66
}
77
}

test-packs/latest/datapacks/test-framework/src/test.mcb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,11 @@ dir armor_stand {
4141
}
4242
}
4343
}
44+
45+
function test_precise_camera_rotation {
46+
function animated_java:global/remove/everything
47+
execute positioned 0 1 0 rotated 0 0 run function animated_java:armor_stand/summon {args:{animation:'camera_test',start_animation:true}}
48+
gamemode spectator @s
49+
execute as @n[tag=aj.global.root] run function animated_java:armor_stand/as_camera {name:'camera',command:'spectate @s @p'}
50+
}
4451
}

test-packs/latest/resources/pack.mcmeta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pack": {
3-
"min_format": 69,
3+
"min_format": 74,
44
"max_format": 9999999,
55
"description": "AJ Testing RP"
66
}

0 commit comments

Comments
 (0)