--------------------------------------------------------------------------------------------------------------------------------------
muevo una capsula por pantalla adelante atras izquierda derecha y sube en dos velocidades y cae por gravedad al dejar de presionar las teclas _z_ y _r_ a diferentes velocidades
-------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
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_A:
#queue_free()
translate(Vector3(1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_D:
#queue_free()
translate(Vector3(-1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_W:
#queue_free()
translate(Vector3(0,0,1))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_S:
#queue_free()
translate(Vector3(0,0,-1))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_Z:
#queue_free()
translate(Vector3(0,1,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_R:
#queue_free()
translate(Vector3(0,2,0))
pass
----------------------------------------------------------------------------------------------------------------------------
Mueve un cubo alante atras derecha izquierda arriba avajo , tiene gravedad tambien
--------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
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_Q:
#queue_free()
translate(Vector3(1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_V:
#queue_free()
translate(Vector3(-1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_C:
#queue_free()
translate(Vector3(0,0,1))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_X:
#queue_free()
translate(Vector3(0,0,-1))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_Z:
#queue_free()
translate(Vector3(0,1,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_R:
#queue_free()
translate(Vector3(0,-1,0))
pass
-------------------------------------------------------------------------------
muebe cubo derecha e izquierda delante detras
---------------------------------------------------------------
extends RigidBody3D
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_Q:
#queue_free()
translate(Vector3(1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_V:
#queue_free()
translate(Vector3(-1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_C:
#queue_free()
translate(Vector3(0,0,1))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_X:
#queue_free()
translate(Vector3(0,0,-1))
pass
---------------------------------------------------------------------------------------------------------------------------------
cuando presiono -Q- muebe cubo a un lado, cuando presiono -V- lo muevo al contrario
---------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
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_Q:
#queue_free()
translate(Vector3(1,0,0))
pass
if event is InputEventKey and event.pressed:
if event.keycode == KEY_V:
#queue_free()
translate(Vector3(-1,0,0))
pass
---------------------------------------------------------------------------------------------------------------------------------
Al presionar tecla -Q- un cubo sube hacia arriba y buelve a caer al soltar esa tecla
translate(Vector3(0,1,0))............el 1 cordenada arriva avajo la y
imagino los ceros coordenadas derecha izquierda delante detras
-----------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
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_Q:
#queue_free()
translate(Vector3(1,0,0))
pass
---------------------------------------------------------------------------------------------------------------------------------
Al presionar tecla -Q- un cubo sube hacia arriba y buelve a caer al soltar esa tecla
translate(Vector3(0,1,0))............el 1 cordenada arriva avajo la y imagino los ceros coordenadas derecha izquierda delante detras
-----------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
pass
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_Q:
#queue_free()
translate(Vector3(0,1,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA add_constant_force(Vector3(0,0,-0.06))
muy bueno aplica fuerza hacia un lado en el rigbody pero solo si se
presiona la tecla "O"
TIPO RigidBody3D
otra forma de dirigirse al teclado para hacer una haccion......
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
pass
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_O:
#queue_free()
add_constant_force(Vector3(0,1,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA add_constant_force(Vector3(0,0,-0.06))
muy bueno aplica fuerza hacia un lado en el rigbody pero solo si se
presiona la tecla "U"
TIPO RigidBody3D
este script es una extension de otro , aun no comprendo el concepto o la utilidad pero me funciona en mis practicas
extends "res://RigidBody3D5ZEPELIN10.gd"
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
pass
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_U:
#queue_free()
add_constant_force(Vector3(0,0,-0.06))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA add_constant_force(Vector3(0,0,0.06)) muy bueno aplica fuerza hacia un lado en el rigbody pero solo si se presiona la tecla "T"
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
pass
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_T:
#queue_free()
add_constant_force(Vector3(0,0,0.06))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA add_constant_force(Vector3(0,0.6,0)) muy bueno aplica fuerza hacia arriba en el rigbody pero solo si se presiona la tecla "Y"
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
pass
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_Y:
#queue_free()
add_constant_force(Vector3(0,0.6,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA add_constant_forceY MUEBE UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
add_constant_force(Vector3(0.03,0,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA apply_torque_impulse Y MUEBE UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
apply_torque_impulse(Vector3(0.03,0,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA apply_impulse Y MUEBE HACIA ARRIBA UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
#apply_central_force(Vector3(0,7,0))
apply_impulse(Vector3(0.1,0,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA apply_impulse Y MUEBE HACIA ARRIBA UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
#apply_central_force(Vector3(0,7,0))
apply_impulse(Vector3(1,0,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA UNA FUERZA Y MUEBE HACIA ARRIBA UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
apply_central_force(Vector3(0,6,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA UNA FUERZA Y MUEBE HACIA ARRIBA UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
-------------------------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
apply_central_force(Vector3(0,4,0))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
APLICA UNA FUERZA Y MUEBE DE LADO UN CUBO, VECTOR3 0,0,5 UN LADO
0,5,0 UN LADO HACIA ARRIBA
5,0,0 UN LADO HACIA OTRO LADO.....
TIPO RigidBody3D
------------------------------------------------------------------------------------------------------------------------------------------- extends RigidBody3D
func _ready():
pass
# add_central_force has to be called every frame in 3D
func _process(delta):
apply_central_force(Vector3(0,0,5))
pass
-----------------------------------------------------------------------------------------------------------------------------------------
ROTAR TIPO MeshInstance3D, PUEDE CONTENER UN TEXTO, O UN CUBO O UNA ESFERA ETC ETC
-------------------------------------------------------------------------------------------------------------------------------------------
extends MeshInstance3D
# 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):
rotate_y(0.003)
pass
---------------------------------------------------------------------------------------------------------------------------
borra de pantalla la rosca al apretar la tecla B
tipo Meshinstance
---------------------------------------------------------------------------------------------------------------------------
extends MeshInstance3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_B:
queue_free()
#rotate_x(1.33)
#get_tree().quit()
---------------------------------------------------------------------------------------------------------------------------
gira la rosca al apretar la tecla M
tipo Meshinstance
---------------------------------------------------------------------------------------------------------------------------
extends MeshInstance3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_M:
rotate_x(1.33)
---------------------------------------------------------------------------------------------------------------------------
gira el cubo al apretar la tecla B
---------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_B:
rotate_x(2.33)
#get_tree().quit()
---------------------------------------------------------------------------------------------------------------------------
gira el cubo al apretar la tecla A
---------------------------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_A:
rotate_x(2.33)
----------------------------------------------------------------------------------------------------------
gira el cubo al apretar la tecla ESCAPE y hace sonido proboca sonido
que se pone arrastrando directamente al script y escribiendo
.play()
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_ESCAPE:
rotate_x(1.33)
$AudioStreamPlayerZUMBIDO.play()
#get_tree().quit()
----------------------------------------------------------------------------------------------------------
gira el cubo al apretar la tecla ESCAPE
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_ESCAPE:
rotate_x(10.33)
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse de otra forma funciona cambio el eje z-x-y y archivo de audio que se arrastra directamente al script, funciona a la perfeccion
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_z(0.33)
$AudioStreamPlayeralgirasuenadisparo.play()
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse de otra forma funciona cambio el eje z-x-y
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_z(0.33)
#rotate_y(-event.relative.x * 1.005)
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse de otra forma funciona cambio el eje z-x-y
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_x(0.3)
#rotate_y(-event.relative.x * 1.005)
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse de otra forma funciona
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_y(0.3)
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse a mas velocidad
----------------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_y(-event.relative.x * 1.005)
----------------------------------------------------------------------------------------------------------
girar un cubo externo no player al girar el mouse
----------------------------------------------------------------------------------------------------
extends RigidBody3D
func _ready():
Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
rotate_y(-event.relative.x * .005)
------------------------------------------------------------------------------------------------------------------------------
rotar por tres angulos ala vez z,y,x
-----------------------------------------------------------------------------------------
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):
#rotate_object_local(Vector3(0, 1, 0), 0.1)
rotate_object_local(Vector3(0, 1, 0), 0.001 )
pass
rotate_object_local(Vector3(0, 0, 1), 0.001 )
pass
rotate_object_local(Vector3(1, 0, 0), 0.001 )
pass
Añado video y scripts en gd para poder girar sobre si mismo un cubo o cualquier objeto en la pantalla de Godot, permite girarlo constanteme en cualquier eje x y z , y cambiarle la velocidad, para la camara funciona exactamente igual solo cambia la primera linea,,,,,,bueno es un comienzo mirando el video y practicando lo escrito algo se puede hacer.......
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):
rotate_y(2)
pass
-------------------------------------------------------------------------------------------------------------------------------
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):
rotate_x(0.1)
pass
------------------------------------------------------------------------------------------------------------------------------
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):
rotate_z(1.2)
pass
--------------------------------------------------------------------------------------------------------------------------------
atencion a este que gira la camara cambia la primera linea en vez de
extends RigidBody3D es
extends Camera3D
En internet solo encuentro excripts complicadisimos o que no sirven para nada co el tipico "hola mundo"
con forme valla imvestigando y aprendiendo ire ampliando el blog......de aqui a unos 5 años Godot abra evolucionado.....adios Unity...¡¡chao!!
-----------------------------------------------------------------------------------------------------------------------------------
extends Camera3D
# 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):
rotate_z(0.002)
pass
Tambien consegi rotarlos en C# cosa que me alegra por que tengo muchos scripts en C # aprendidos a usar en unity y quizas me sirban para Godot......
----------------------------------------------------------------------------------------------------------------------------
using Godot;
using System;
public partial class RigydBody3D25enC1 : RigidBody3D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
RotateObjectLocal(new Vector3(1, 0, 0), 0.1f);
}
}
------------------------------------------------------------------------------------------------------------------
aqui un ejemplo de C# en Unity ....comparalo con el de godot e intenta aplicarlo
---------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using System.Collections;
public class RUEDA : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.transform.Rotate (new Vector3 (0, 1, 0), 1);
}
}
No hay comentarios:
Publicar un comentario