Skip to main content
Became Hot Network Question
edited body
Source Link

I am trying to write some code, where upon running it will place a 3d obj. It is a tool to help build a map before game runtine.

It is a simple 3d obj arrayMesh I am trying to add to a tscn file.

In godot I have:

@tool
extends EditorScript

# scene to 3d obj to
var scene = preload("res://main.tscn").instantiate()

# load 3d pbject
var grass = preload("res://map/Models/OBJ format/grass.obj")

func _run():
    # get node to append map to
    var map_holder_node = scene.get_node("map_holder")
    
    map_holder_node.add_child(grass.new())
    

I get the error:

res://map/generate_map.gd:1714 - Invalid call. Nonexistent function 'new' in base 'ArrayMesh'.

Any ideas?

I am trying to write some code, where upon running it will place a 3d obj. It is a tool to help build a map before game runtine.

It is a simple 3d obj arrayMesh I am trying to add to a tscn file.

In godot I have:

@tool
extends EditorScript

# scene to 3d obj to
var scene = preload("res://main.tscn").instantiate()

# load 3d pbject
var grass = preload("res://map/Models/OBJ format/grass.obj")

func _run():
    # get node to append map to
    var map_holder_node = scene.get_node("map_holder")
    
    map_holder_node.add_child(grass.new())
    

I get the error:

res://map/generate_map.gd:17 - Invalid call. Nonexistent function 'new' in base 'ArrayMesh'.

Any ideas?

I am trying to write some code, where upon running it will place a 3d obj. It is a tool to help build a map before game runtine.

It is a simple 3d obj arrayMesh I am trying to add to a tscn file.

In godot I have:

@tool
extends EditorScript

# scene to 3d obj to
var scene = preload("res://main.tscn").instantiate()

# load 3d pbject
var grass = preload("res://map/Models/OBJ format/grass.obj")

func _run():
    # get node to append map to
    var map_holder_node = scene.get_node("map_holder")
    
    map_holder_node.add_child(grass.new())
    

I get the error:

res://map/generate_map.gd:14 - Invalid call. Nonexistent function 'new' in base 'ArrayMesh'.

Any ideas?

Source Link

inserting 3d .obj into scene with godot code

I am trying to write some code, where upon running it will place a 3d obj. It is a tool to help build a map before game runtine.

It is a simple 3d obj arrayMesh I am trying to add to a tscn file.

In godot I have:

@tool
extends EditorScript

# scene to 3d obj to
var scene = preload("res://main.tscn").instantiate()

# load 3d pbject
var grass = preload("res://map/Models/OBJ format/grass.obj")

func _run():
    # get node to append map to
    var map_holder_node = scene.get_node("map_holder")
    
    map_holder_node.add_child(grass.new())
    

I get the error:

res://map/generate_map.gd:17 - Invalid call. Nonexistent function 'new' in base 'ArrayMesh'.

Any ideas?