24 lines
565 B
GDScript
24 lines
565 B
GDScript
extends Node3D
|
|
class_name Player
|
|
|
|
var playerObject
|
|
|
|
func _ready() -> void:
|
|
GlobalVariables.player = self
|
|
playerObject = $Horse
|
|
|
|
func get_object_position():
|
|
return playerObject.global_position
|
|
|
|
func change_object(object):
|
|
var objectPosition = playerObject.position
|
|
var objectRotation = playerObject.rotation
|
|
var objectVelocity = playerObject.linear_velocity
|
|
remove_child(playerObject)
|
|
|
|
add_child(object)
|
|
object.position = objectPosition + Vector3(0, 2, 0)
|
|
object.rotation = objectRotation
|
|
object.linear_velocity = objectVelocity
|
|
playerObject = object
|