improving billboard function of collectables
This commit is contained in:
parent
baf07a3269
commit
2ead9e7a3e
|
|
@ -5,13 +5,11 @@ extends Area3D
|
|||
|
||||
func _process(_delta):
|
||||
var camera = get_viewport().get_camera_3d()
|
||||
# Look in the same direction as the camera
|
||||
var look = camera.to_global(Vector3(0, 0, -100)) - camera.global_transform.origin
|
||||
look = position + look
|
||||
|
||||
look = Vector3(look.x, 0, look.z)
|
||||
var up = (camera.global_position - global_position)
|
||||
up = up.cross(Vector3.UP).cross(up)
|
||||
|
||||
look_at(look, Vector3.UP)
|
||||
look_at(global_position - (camera.global_position - global_position), up)
|
||||
|
||||
func _unhandled_input(event):
|
||||
viewport.push_input(event)
|
||||
|
|
@ -34,6 +32,5 @@ func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal
|
|||
func _on_button_pressed():
|
||||
print("Button pressed")
|
||||
|
||||
|
||||
func _on_line_edit_text_submitted(new_text):
|
||||
print("Text submitted: ", new_text)
|
||||
|
|
|
|||
Loading…
Reference in New Issue