In my project, i wanted to create a similar grab mechanic with the left for dead charger where he grabs you and continuously smashes you to the ground, and the only way to break free is to kill the charger.
using this code i am somewhat able to achieve my goals:
match state:
"idle":
pass
"grabbed":
if crawler == true
global_transform.origin = use_position.global_transform.origin
however i get an error called Invalid get index 'global_transform' (on base: 'previously freed instance'). And whenever i dont move(WASD) while being "grabbed" the game crashes, while if i move(WASD) while being "grabbed" the game doesnt cras.
this is odd for me as i dont know how i can fix this, nor know what the issue is, i have tried "is_instance_valid()" and it only creates issue when the enemy(crawler) is killed, does any of you know what might be the reason/issue for this? and if so, what could i do to fix this? "note, if you guys have a better approach with the grab mechanic, i would be happy to use that instead, thank you in advance!"
Theres some clips so you can see the issue in more details. "Left clip (Not moving/using WASD) Right clip (Moving/using WASD). SOLVED