viernes, 9 de febrero de 2024

PRESIONANDO BOTON IZQUIERDO DEL MOUSE Y PRESIONANDO BOTON DERECHO DEL MOUSE CON GODOT4.2;

 extends CSGSphere3D


func _input(event):


#if event is InputEventMouseMotion:

if Input.is_action_just_pressed("MOUSE_LEFT"):


$AnimationPlayer.play("blanca4")

$"../AudioStreamPlayer3DDISPAROELICOPTERO".play()




--------------------------------------------------------------------------------------------------------------------




 extends CSGSphere3D


func _input(event):


#if event is InputEventMouseMotion:

if Input.is_action_just_pressed("MOUSE_RIGHT"):


$AnimationPlayer.play("blanca4")

$"../AudioStreamPlayer3DDISPAROELICOPTERO".play()






Presiono "e" camara true camara false;

 extends Camera3D


var is_visible = false

var player: Node # Asegúrate de asignar el jugador en el editor


func _input(event):

    if event is InputEventKey:

        if event.scancode == KEY_E:

            if event.pressed:

                # La tecla "E" está presionada, muestra la cámara

                show_camera()

            else:

                # La tecla "E" se soltó, oculta la cámara

                hide_camera()


func hide_camera():

    if is_visible:

        is_visible = false

        self.visible = false

        player.camera = null # Desvincula la cámara del jugador


func show_camera():

    if !is_visible:

        is_visible = true

        self.visible = true

        player.camera = self # Vincula la cámara al jugador nuevamente


jueves, 8 de febrero de 2024

SCRIPT SIMPLE ELEVACION DE UN RigidBody3D EN EL EJE "Y" PARA GODOT 4.2 3D; PRESIONANDO LETRA"e"; y ademas gira presinando "z" o "x";

 extends RigidBody3D


# Called when the node enters the scene tree for the first time.

func _ready():

# Do your initialization actions here (e.g., load animations, set starting values)

pass


# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

# Handle physics updates and actions here (e.g., movement, interactions)

pass


func _unhandled_input(event):

if event is InputEventKey and event.pressed:

if event.keycode == KEY_E:

apply_impulse(Vector3(0, 110, 0))  # Correct casing "X" to "E"

$AudioStreamPlayer3D2.play()  # Correct typo "$AudioStreamPlayer3D2"

pass  # Placeholder for additional actions using KEY_E


if event.keycode == KEY_X:

apply_torque_impulse(Vector3(0, -0.4, 0))  # Correct negative sign


if event.keycode == KEY_Z:

apply_torque_impulse(Vector3(0, 0.4, 0))


# Add additional input handling cases if needed


SCRIPT SIMPLE ELEVACION DE UN RigidBody3D EN EL EJE "Y" PARA GODOT 4.2 3D; PRESIONANDO LETRA"e";

 extends RigidBody3D



# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

pass

func _unhandled_input(event):

if event is InputEventKey and event.pressed:

if event.keycode == KEY_E: 

apply_impulse(Vector3(0,110,0))

$AudioStreamPlayer3D.play()

pass

miércoles, 7 de febrero de 2024

Script para godot4.2 se pone en el AnimationPlayer y hace un loop en la animacion, necesita la "señal" ;

 extends AnimationPlayer


func _on_animation_finished(anim_name):

if anim_name == "Armature|mixamo_com|Layer0":

# Reinicia la animación

play("Armature|mixamo_com|Layer0")

pass # Replace with function body.


Como añadir animaciones de Mixamo a nuestros personajes personalizados de Godot4.2;

Captura de video donde estoy haciendo pruebas para añadir exclusibamente la animacion que me interesa de Mixamo a mi personaje que uso para Godot4.2,

La clave del problema es añadirle el esqueleto, y esta en los circulitos que se ponen en las extremidades, del personaje personalizado, primero has de subir tu personaje a Mixamo en formatos fbx o obj yo los e probado los dos, y de hay desde Mixamo se elige una vez has subido tu personaje ,una animacion y cuando lo a admitido bien y has colocado los circulos en las extremidades del personaje, lo pasas a blebder y desde blender lo exportas a Godot en formato glb.......

En resumen, orden de los pasos que e trabajado yo.......

1- maquehuman.--formatos --obj o fbx--yo use esqueleto de tipo game generico....

2-exportar a Mixamo- colocar los circulitos nen las extremidades

3-exportar a blender---para que desde blender lo transforme todo a formato--- glb

4-exportar a Godot4.2--formato ---glb

 

martes, 6 de febrero de 2024

Script para godot4.2 un personaje, le cambias la animacion, presionando otra tecla;

 extends Node3D


# Variables para controlar si la animación está activa y el nombre de la animación actual

var is_animating = false

var anim_name = ""


# Called when the node enters the scene tree for the first time.

func _ready():

pass


# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

# Reproduce la primera animación al presionar la tecla "M"

if Input.is_action_pressed("ui_up"):

if not is_animating:

$AnimationPlayer.play("Armature|mixamo_com|Layer0")

anim_name = "Armature|mixamo_com|Layer0"

is_animating = true

# Reproduce la segunda animación al presionar la tecla "N"

elif Input.is_action_pressed("ui_down"):

if not is_animating:

$AnimationPlayer.play("otra/otramas")

anim_name = "otra/otramas"

is_animating = true

# Evita repetir la animación mientras se mantiene presionada la tecla

elif is_animating and not Input.is_action_pressed(anim_name):

is_animating = false