Change Cube behavior from blender which is imported with suffix -rigid to STATIC during runtime

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

Hello I have imported a cell fractured cube from blender which uses
-rigid as suffix so its a rigidbody by default but I am trying to change it to static during runtime and via some code, my godot
understanding level can be consider absolute newbie / beginner any
help will be a blessing : ).

Follwing is a still frame of cell fractured cube imported with suffix
-rigid and you can see the object is falling and breaking and i want to change this behaviour to static during runtime via code, and
Rigidbody.MODE_STATIC is doing nothing while mode = Rigidbody.MODE_STATIC is not working either but throwing error
stating ‘mode’ is not declared in the current scope

mode = Rigidbody.MODE_STATIC

I can only guess that this isn’t working because mode here is in a script that doesn’t extend RigidBody. Or, if you have a variable, that variable isn’t a RigidBody (also notice the capitalisation). It’s tough to say from the screen grab; I don’t see any assigned scripts in the hierarchy. For example, this works in making a cube fall after a timeout:

onready var cube: RigidBody = $RigidBody

func _ready():
    cube.mode = RigidBody.MODE_STATIC

func _on_Timer_timeout():
    cube.mode = RigidBody.MODE_RIGID

(where the RigidBody is below a parent Spatial Node, with a Timer and callback connected to the parent)

spaceyjase | 2023-03-27 13:43