How to snap object to floor

Godot Version

4.6

Question

Hi,

In the editors 3d view there is a transform menu with a function 'snap object to floor’ i was wondering how to implement this in gdscript.

The reason is that I have a collection of objects all grouped under one Node3D and selecting all of them and running the menu function does not work. So i thought i would add this into a script on the parent node


func snap():
	for o in get_children():
		if o is StaticBody3D:
			(o as StaticBody3D).snap_object_to_floor()

But the function snap_object_to_floor() doesnt exist in the script.