![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | bgegg |
i add this code for mesh adding to click position.
extends Spatial
var scene
var node:Spatial
var get_camera:Camera = null
var camera_ray_pos
func _ready():
scene = load("res://0_practice_folder/add_mesh_3d/instance_box.tscn")
node = scene.instance()
func _on_StaticBody_input_event(camera, event, click_position, click_normal, shape_idx):
if Input.is_mouse_button_pressed(BUTTON_MIDDLE):
node.set_translation(click_position)
add_child(node)
i want add mesh to grid place like mine craft.
where is tutorial or reference about this?
and i cast ray from camera to staticbody(in front of the camera) for z position.
is z position fake?
is exist real z position?