Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | abhaskumarsinha | |
Old Version | Published before Godot 3 was released. |
extends Camera
func _ready():
# Called every time the node is added to the scene.
# Initialization here
set_process(true);
func _process(delta):
if Input.is_action_pressed("a"):
var rota = rad2deg(get_node(".").get_rotation().y);
rota = rota + 5;
get_node(".").set_rotation(Vector3(0, deg2rad(rota), 0));
if Input.is_action_pressed("d"):
var rotd = rad2deg(get_node(".").get_rotation().y);
var srotd = rotd - 5;
get_node(".").set_rotation(Vector3(0, deg2rad(srotd), 0));
if Input.is_action_pressed("w"):
var rotw = rad2deg(get_node(".").get_rotation().x);
rotw = rotw + 5;
get_node(".").set_rotation(Vector3(deg2rad(rotw), 0 , 0));
if Input.is_action_pressed("s"):
var rots = rad2deg(get_node(".").get_rotation().x);
rots = rots - 5;
get_node(".").set_rotation(Vector3(deg2rad(rots), 0, 0));
pass
When I execute it, it, works fine, but using d or a key after using w or s, resets the view. For example, when I use d key to change the view to 45 degree, and use w key to move up, the view gets reset
Link here Link to the pastebin
abhaskumarsinha | 2017-10-02 06:20