viernes, 1 de noviembre de 2024

Escala un extends Label3D en eje -x- y en eje -y- con GDScript ;

 extends Label3D


var scale_speed = 0.2

var scale_direction = 1


func _ready() -> void:

pass  # Replace with function body.


func _process(delta: float) -> void:

# Escalado en los ejes X e Y

scale.x += scale_speed * scale_direction * delta

scale.y += scale_speed * scale_direction * delta


# Cambiar la dirección de escalado cuando alcance ciertos límites

if scale_direction == 1 and scale.x >= 0.3:

scale_direction = -1

elif scale_direction == -1 and scale.x <= 0.01:

scale_direction = 1


extends Label3D escalar un Label 3d mediante GDScript;

 extends Label3D


var scale_speed = 0.8

var scale_direction = 1


func _ready() -> void:

pass  # Replace with function body.


func _process(delta: float) -> void:

# Escalado en el eje X

scale.x += scale_speed * scale_direction * delta


# Cambiar la dirección de escalado cuando alcance ciertos límites

if scale_direction == 1 and scale.x >= 0.3:

scale_direction = -1

elif scale_direction == -1 and scale.x <= 0.01:

scale_direction = 1


GDScript camara rota en diversas direcciones, muy bueno;

 extends Camera3D


var target_rotation_x = PI / 2  # Ángulo de rotación objetivo en el eje X

var target_rotation_y = PI / 4  # Ángulo de rotación objetivo en el eje Y


var current_rotation_x = 0.0

var current_rotation_y = 0.0


var rotation_speed = 0.7  # Ajusta esta variable para cambiar la velocidad de rotación


var is_rotating_forward_x = true  # Indica si la rotación en X es en sentido horario

var is_rotating_forward_y = false  # Indica si la rotación en Y es en sentido horario


func _process(delta: float) -> void:

# Rotación en el eje X

if is_rotating_forward_x:

if current_rotation_x < target_rotation_x:

rotate_x(delta * rotation_speed)

current_rotation_x += delta * rotation_speed

if current_rotation_x >= target_rotation_x:

current_rotation_x = target_rotation_x

is_rotating_forward_x = false

else:

if current_rotation_x > -target_rotation_x:

rotate_x(-delta * rotation_speed)

current_rotation_x -= delta * rotation_speed

if current_rotation_x <= -target_rotation_x:

current_rotation_x = -target_rotation_x

is_rotating_forward_x = true


# Rotación en el eje Y

if is_rotating_forward_y:

if current_rotation_y < target_rotation_y:

rotate_y(delta * rotation_speed)

current_rotation_y += delta * rotation_speed

if current_rotation_y >= target_rotation_y:

current_rotation_y = target_rotation_y

is_rotating_forward_y = false

else:

if current_rotation_y > -target_rotation_y:

rotate_y(-delta * rotation_speed)

current_rotation_y -= delta * rotation_speed

if current_rotation_y <= -target_rotation_y:

current_rotation_y = -target_rotation_y

is_rotating_forward_y = true