Created
December 18, 2021 22:29
-
-
Save erdavids/0820293c257c19e307dc63e5c076fb08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends RigidBody | |
var rotating = false | |
var prev_mouse_position | |
var next_mouse_position | |
func _process(delta): | |
if (Input.is_action_just_pressed("Rotate")): | |
rotating = true | |
prev_mouse_position = get_viewport().get_mouse_position() | |
if (Input.is_action_just_released("Rotate")): | |
rotating = false | |
if (rotating): | |
next_mouse_position = get_viewport().get_mouse_position() | |
rotate_y((next_mouse_position.x - prev_mouse_position.x) * .1 * delta) | |
rotate_z(-(next_mouse_position.y - prev_mouse_position.y) * .1 * delta) | |
prev_mouse_position = next_mouse_position | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment