#Control over character doesn't return after tween plays
1 messages · Page 1 of 1 (latest)
What is calling climb_animation?
await and tweens both run asynchronously, they can't be called from _process() or any similar function safely.
But if you're willing to do the hacks. The next thing i'd check here is if you have anything that sets climbing back to false.
This function is what sets climbing back to false, but it's also in _process:
if !global_position.distance_to(target_climb) < 0.01:
global_position = lerp(global_position, target_climb, delta * 4.0)
else:
target_climb = Vector3.ZERO
climbing = false```
What is responsible for taking control away from the player? the "climbing" variable?
None of of my functions should be taking away mouse control from the player
So what is taking away control from it? From the title.
Apparently this function is:
if event is InputEventMouseMotion and !climbing:
if !sliding:
rotate_y(-event.relative.x * SENS_X)
if sliding:
head.rotate_y(-event.relative.x * SENS_X)
head.rotate_x(-event.relative.y * SENS_Y)
head.rotation.x = clamp(head.rotation.x, -1.5533, 1.5533)```
But climbing should be going back to false at some point so I don't get why control doesn't come back
A simple and reliable solution is to make the Tween itself unset climbing once it is done.
Because atm you're relying on a condition becoming true as a result of your Tween. Which can fail.
You can tween this after your other tweeners:
tween.tween_callback(set.bind("climbing", false))
I guess I'll try that