Turning a Character2D into a static/frozen state?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By aidave

Is there a good way to set a Character2D into something that’s like “freeze” mode in RigidBody2D?

I want NPCs to be able to “freeze” in place and be unmovable, while still performing scripted actions like shooting. RigidBody Items fall on them and move them around in undesirable ways, like launching them into the sky or pushing them into the ground, but I still want those RigidBody to not pass through them, just like a StaticBody2D.

In my case it isn’t really possible to change the node type at runtime, since the script is inherited from Character2D.

:bust_in_silhouette: Reply From: zhyrin

A character body only moves when you call one of the move_and_xx() functions.
If you want a frozen state, you should just not call those functions.

Thank you!

I was setting velocity to 0,0 trying to solve this >D

aidave | 2023-03-15 00:03