sábado, 13 de enero de 2024

SCRIPT PARA GODOT3D 4.2 QUE TIENE MEJORAS EN MANEJAR UN APARATO VOLADOR;

 extends RigidBody3D



func _ready():



# Agrega el código que deseas ejecutar aquí.

pass




func _process(delta):

# Agrega el código que deseas ejecutar aquí.

pass

























#func _input(event: InputEvent):

#if event is InputEventKey and event.scancode == KEY_N and event.pressed:




#rotate_y(0.1)





















func _unhandled_input(event):

#if event is InputEventKey:

#if event.pressed and event.keycode == KEY_O:

if event is InputEventKey and event.pressed:

if event.keycode == KEY_J:

#queue_free()

translate(Vector3(111,0,0) * get_process_delta_time())

$AudioStreamPlayer.play()

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_L:

 

#queue_free()

translate(Vector3(-111,0,0) * get_process_delta_time())

$AudioStreamPlayer.play()

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_I:

translate(Vector3(0,0,111) * get_process_delta_time())

$AudioStreamPlayer.play()

pass








 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_K:

 

#queue_free()

translate(Vector3(0,0,-111) * get_process_delta_time())

$AudioStreamPlayer.play()

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_Z:

#queue_free()

translate(Vector3(0,111,0) * get_process_delta_time())

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_R:

 

#queue_free()

translate(Vector3(0,-111,0) * get_process_delta_time())

pass 










#if event is InputEventKey and event.pressed:

#if event.keycode == KEY_O:

 

#queue_free()

#rotate_y(0.5) 

#pass 








 

#if event is InputEventKey and event.pressed:

#if event.keycode == KEY_P:

 

#queue_free()

#rotate_y(-0.5)

#pass 

#if event.keycode == KEY_9:

#add_constant_force(Vector3(0,-33,0))

#pass

#if event.keycode == KEY_8:

#add_constant_force(Vector3(0,33,0))

#pass

if event.keycode == KEY_Z:

apply_torque_impulse(Vector3(0,-0.1,0))

pass


if event.keycode == KEY_X:

apply_torque_impulse(Vector3(0, 0.1,0))

pass

if event.keycode == KEY_E: 


apply_impulse(Vector3(0,110,0))

pass


if event.keycode == KEY_W:

#move_and_slide(Vector3(0, 0, 40))

apply_impulse(Vector3(0,0,40))

pass





if event.keycode == KEY_S: 

apply_impulse(Vector3(0,0,-40))

pass

if event.keycode == KEY_A: 

apply_impulse(Vector3(40,0,0))

pass

if event.keycode == KEY_D: 

apply_impulse(Vector3(-40,0,0))

pass


if event.keycode == KEY_1:

rotate_z(1)

pass

if event.keycode == KEY_2:

rotate_x(1)

#queue_free()

pass


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

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

EXPLICACION: FUNCIONA ELEVARSE -E- ALANTE ATRAS IZQUIERDA DERECHA W-A-S-D

GIRAR -Z-X- , TIENE EL DEFECTO QUE CUANDO A GIRADO AL PRESIONAR -W- YA NO AVANZA ADELANTE AVANZA HACIA ATRAS, Y AL GIRAR DE NUEVO , VUELVE A AVANZAR PRESIONANDO -W-, CON LA -S- OCURRE IGUAL VA HACIA ATRAS Y SI AGIRADO CAMBIA Y VA HACIA ADELANTE........YA LO CORREGIRE POCO A POCO....

No hay comentarios:

Publicar un comentario