0 votes

Like in blender where I can save apply scaling of an object, and make its value 1 and keep the scaling, how can I achieve this in godot. I want to scale an object but after the scaling I want to save the scaling and make it's scaling value 1.

in Engine by (14 points)

2 Answers

0 votes

you cant do it in the editor environment.

You have to write a script for that. This class can help you:


would look like. This only works with one surface and does not work on primitives

extends MeshInstance

export(bool) var update setget _update

func _update(value):
    if value:

func update():
    var mdt = MeshDataTool.new()
    #will only work with 1 surfcae by now
    mdt.create_from_surface(mesh, 0)

    #step through every vetex of the surface
    for i in range(mdt.get_vertex_count()):
        #multiply position and normal by scale to apply scaling
        var vertex = mdt.get_vertex(i) * scale
        var normal = mdt.get_vertex_normal(i) * scale
        #write it back to the surface
        mdt.set_vertex(i, vertex)
        mdt.set_vertex_normal(i, normal)

    #make a new mesh
    mesh = ArrayMesh.new()
    #commit changes to mesh
    mdt.commit_to_surface( mesh )

    #reset scale to 1
    scale = Vector3(1,1,1)
    #tell the inspector something has changed
by (2,470 points)
0 votes

depending on what you need, just make it a child. the parent is scale 1 and child is scale x?

or maybe use global_scale and leave scale alone?


by (1,661 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.