Initial Commit
This commit is contained in:
20
scripts/control_box.gd
Normal file
20
scripts/control_box.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends MeshInstance3D
|
||||
|
||||
var movingTowards: Vector3
|
||||
var currentLocation: Vector3
|
||||
|
||||
func _ready() -> void:
|
||||
GameEngine.getGE().controlBox = self
|
||||
currentLocation = self.position
|
||||
movingTowards = currentLocation
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var currentMousePos = GameEngine.getGE().mainCamera.getMouseRayCast();
|
||||
|
||||
if currentMousePos != Vector3.INF && currentMousePos != movingTowards:
|
||||
movingTowards.x = currentMousePos.x
|
||||
|
||||
self.position = self.position.move_toward(movingTowards, GameEngine.getGE().getGameSpeed(delta))
|
||||
|
||||
func getMoveToLocation() -> Vector3:
|
||||
return self.position
|
Reference in New Issue
Block a user