Created
June 8, 2019 20:32
Star
You must be signed in to star a gist
Godlander's modified camera system for kingdom hearts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @s is the player in the minecart | |
# 0-0-0-0-1 is the AEC the camera minecart is riding on | |
# 0-0-0-0-2 is sora's true position marker | |
# 0-0-0-0-3 is the point the camera focuses on | |
# 0-0-0-0-4 is the AEC sora's display model rides on | |
# 0-0-0-0-5 is sora's display model | |
# 0-0-9-0-8 and 0-0-9-0-9 are temporary markers used for math | |
# movement | |
execute store result score *control_hx kh run data get entity @s Motion[0] 10000 | |
execute store result score *control_hz kh run data get entity @s Motion[2] 10000 | |
execute store result entity 0-0-0-0-2 Motion[0] double 0.002 run scoreboard players get *control_hx kh | |
execute store result entity 0-0-0-0-2 Motion[2] double 0.002 run scoreboard players get *control_hz kh | |
tp 0-0-0-0-4 0-0-0-0-2 | |
# arctangent2 to get the angle we're walking | |
summon area_effect_cloud 0.0 0.0 0.0 {UUIDMost:9L,UUIDLeast:8L} | |
summon area_effect_cloud 0.0 0.0 0.0 {UUIDMost:9L,UUIDLeast:9L} | |
execute store result entity 0-0-9-0-9 Pos[0] double 1 run scoreboard players get *control_hx kh | |
execute store result entity 0-0-9-0-9 Pos[2] double 1 run scoreboard players get *control_hz kh | |
tp 0-0-9-0-8 0.0 0.0 0.0 facing entity 0-0-9-0-9 | |
execute unless score *control_hx kh matches 0 run data modify entity 0-0-0-0-5 Rotation set from entity 0-0-9-0-8 Rotation | |
execute unless score *control_hx kz matches 0 run data modify entity 0-0-0-0-5 Rotation set from entity 0-0-9-0-8 Rotation | |
execute at 0-0-0-0-2 rotated as @s run tp 0-0-0-0-3 ~ ~ ~ ~ ~ | |
# position camera higher on sora's body | |
execute at 0-0-0-0-3 run tp 0-0-0-0-3 ~ ~1 ~ | |
scoreboard players set *camera_distance kh 400 | |
execute as 0-0-0-0-3 run function kh:position_camera | |
tp 0-0-0-0-1 0-0-0-0-3 | |
# trick to update client | |
scoreboard players add *camera_update kh 1 | |
execute if score *camera_update kh matches 2.. run scoreboard players set *camera_update kh 0 | |
execute store result entity 0-0-0-0-1 Air short 1 run scoreboard players get *camera_update kh | |
execute store result entity 0-0-0-0-4 Air short 1 run scoreboard players get *camera_update kh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment