23 lines
688 B
GDScript
23 lines
688 B
GDScript
extends RigidBody
|
|
|
|
var outline_visible = false
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
self.mode = RigidBody.MODE_RIGID
|
|
get_node("MeshInstance/MeshOutline").visible = false
|
|
|
|
func _toggle_outline():
|
|
outline_visible = !outline_visible
|
|
if outline_visible:
|
|
self.mode = RigidBody.MODE_STATIC
|
|
get_node("MeshInstance/MeshOutline").visible = true
|
|
else:
|
|
self.mode = RigidBody.MODE_RIGID
|
|
get_node("MeshInstance/MeshOutline").visible = false
|
|
|
|
func _on_Dice_input_event(_camera, event, _click_position, _click_normal, _shape_idx):
|
|
if event is InputEventMouseButton:
|
|
if event.button_index == BUTTON_LEFT and event.pressed:
|
|
_toggle_outline()
|