Godot Version
4.5.1
Question
I’m on 4.5.1 mono and from what I understand we should be able to hold CTRL and then drag the scale gizmo to scale in increments but it’s not working for me.
EDIT: Also, i set the snap to 0.03125 because thats the exact amount that equals 1 pixel in my 3D models but godot always shortens it to 3 decimals, “0.031”. Is there a way to stop that?
I added a script to the floor objects which will snap their position and scale to the grid and also expand their UV1 scale so the textures will repeat.
using Godot;
using System;
[Tool]
public partial class FloorSnap : Node3D
{
bool toggle = false;
public override void _Notification(int n)
{
if (Engine.IsEditorHint())
{
SetNotifyTransform(true);
SetNotifyLocalTransform(true);
if (toggle) { return; }
if (n == 44)
{
toggle = true;
MeshInstance3D mesh = GetNode<MeshInstance3D>("Mesh");
StandardMaterial3D mat = mesh.GetActiveMaterial(0) as StandardMaterial3D;
Vector3 v = Snap(Transform.Basis.Scale, 0.03125f);
mat.Uv1Scale = new Vector3(v.X, v.Z, 0f);
mesh.SetSurfaceOverrideMaterial(0, mat);
Position = Snap(Position, 0.03125f);
Scale = v;
toggle = false;
}
}
}
Vector3 Snap(Vector3 v, float g)
{
return new Vector3(
Mathf.Round(v.X / g) * g,
Mathf.Round(v.Y / g) * g,
Mathf.Round(v.Z / g) * g
);
}
}
But I don’t like this because there is probably some overhead to attaching scripts to a bunch of geometry. Is there a C# preprocessor directive for excluding code in final build?