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