godot-third-person-basic-scene/PlayerB/Player/Status.gd

30 lines
1.5 KiB
GDScript3
Raw Normal View History

extends Control
@onready var player = get_parent()
@onready var direction = $Control/Direction
@onready var velocity = $Control/Velocity
@onready var mesh = $Control/mesh
func _physics_process(_delta):
var h_rot = get_parent().get_node("SpringArm3D").transform.basis.get_euler().y
$Control.set_rotation(h_rot)
# direction.rotation = atan2(player.direction.z, player.direction.x)
velocity.position = Vector2(player.velocity.x, player.velocity.z) * 10
mesh.rotation = 90-get_node("../Armature").rotation.y - player.rotation.y - .5
func _process(_delta):
$Label.set_text("1234")
var p:Node3D = get_parent().get_node("SpringArm3D").get_node("Camera")
#.character_node.get_node("LookAtObject")
$Label.set_text( "LookAtObject: " + str(get_parent().get_node("LookAtObject").get_position()) )
$Label2.set_text( "Camera: " + str(p.get_position()) + " <-> " + str(p.get_rotation()) )
$Label3.set_text( "Player D: " + str(player.get_position()) + " <-> " + str(player.get_rotation()) )
$Label4.set_text( "Camera: " + str(get_parent().get_node("SpringArm3D").get_position()) + " <-> " + str(get_parent().get_node("SpringArm3D").get_rotation()) )
#$Label4.set_text( "direction: " + str(direction.get_position()) )
$Label5.set_text( "direction: " + str(direction.get_position()) + " <-> " + str(direction.get_rotation()) )
$Label6.set_text( "velocity: " + str(velocity.get_position()) + " <-> " + str(velocity.get_rotation()) )
$Label7.set_text( "follow_camera:" + str(get_parent().get_node("CharacterMovementComponent").follow_camera))
pass