summaryrefslogtreecommitdiff
path: root/demos/3d/mousepick_test/mousepick.gd
blob: c96091b650327c3966415dabb7cb5cdd913ea843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

extends RigidBody

# member variables here, example:
# var a=2
# var b="textvar"

var gray_mat = FixedMaterial.new()

var selected=false

func _input_event(camera,event,pos,normal,shape):
	if (event.type==InputEvent.MOUSE_BUTTON and event.pressed):
		if (not selected):
			get_node("mesh").set_material_override(gray_mat)
		else:
			get_node("mesh").set_material_override(null)
		
		selected = not selected
		

func _mouse_enter():
	get_node("mesh").set_scale( Vector3(1.1,1.1,1.1) )

func _mouse_exit():
	get_node("mesh").set_scale( Vector3(1,1,1) )

func _ready():
	# Initalization here
	pass