Godot interaction system init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
extends Node3D
|
||||
|
||||
@export var moveDistance: float = 2.0
|
||||
@export var moveSpeed: float = 3.0
|
||||
|
||||
var up: bool = false
|
||||
var startPos: Vector3 = Vector3.ZERO
|
||||
|
||||
func _ready():
|
||||
startPos = global_position
|
||||
|
||||
func toggleMove(button: Button3D):
|
||||
up = !up
|
||||
|
||||
func holdMove(button: Button3D):
|
||||
up = true
|
||||
|
||||
func releaseMove(button: Button3D):
|
||||
up = false
|
||||
|
||||
func _physics_process(delta):
|
||||
var target: Vector3 = startPos
|
||||
|
||||
if up:
|
||||
target += Vector3(0, moveDistance, 0)
|
||||
|
||||
global_position = global_position.lerp(target, delta * moveSpeed)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cvg1f1wtahy0t
|
||||
Reference in New Issue
Block a user