Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Xian |
Okay I am not new to programming and i just came from a different game engine.
i need to spawn/generate/instantiate an object into my scene using gdscript(the moment it runs).
After viewing the 3D environment, i know object MeshInstance should contain Mesh, transfrom, visibility and so on(basic understanding of objects)
So I tried to manually spawn a plane mesh and make the code similar to its parameters:
var plane = MeshInstance.new()
plane.mesh = PlaneMesh
plane.skeleton = "Root"
i received a logic error. it ran but i dont see my plane mesh also i cant seem to use
plane.transform.translation or
plane.transform.translation.x,
plane.transform.translation.y,
plane.transform.translation.z,
to set the position of my new plane mesh, even though translation should have been a node under transform.
Please help. How do i spawn an object and set its coordinates.
PS i was searching online but it talked about “Classtype” or “Add_child
” or “set_nam
e”
all of which i cant seem to use