0 votes

I'm making a KSP/SimpleRockets 2-like game, & I'm wondering if you can make something similar to the KSP fairing building system with procedural meshes.

Godot version 3.2.3
in Engine by (56 points)

What do you mean with procedural meshes? Do you mean building with primitives or modifying them with procedural shaders?

1 Answer

+1 vote

The wiki has some good documentation on the options Godot provides:

For something like rocket parts, you could also modify existing meshes by tweaking its size, or the position of certain vertices. For that, MeshDataTool would work best.
Here is an example of proceduraly stretching a part:

var data_tool := MeshDataTool.new()
data_tool.create_from_surface(load("mesh.obj"), 0)
for vertex_id in data_tool.get_vertex_count():
    var vertex := data_tool.get_vertex(vertex_id)
    # push all vertices that are on the right more to the right
    if vertex.x > .5:
        data_tool.set_vertex(vertex_id, vertex + Vector3.RIGHT)
by (40 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.