12345678910111213141516171819202122232425262728293031 |
- extends RayCast
- export var maxlength = 10.0
- var distance = 0
- # Declare member variables here. Examples:
- # var a = 2
- # var b = "text"
- # Called when the node enters the scene tree for the first time.
- func _ready():
- cast_to = Vector3(0,-maxlength,0)
- func _physics_process(delta):
- if !is_colliding():
- $intersection.visible = false
- $ray_handle.scale = Vector3(0,distance,0)
- return
- var collision_p = to_local(get_collision_point())
- distance = collision_p.length()
- $ray_handle.scale = Vector3(1,distance,1)
- $intersection.visible = true
- $intersection.translation = collision_p
- # Called every frame. 'delta' is the elapsed time since the previous frame.
- #func _process(delta):
- # pass
|