rotation gizmo partial
This commit is contained in:
parent
bcb17faaed
commit
ff0d1a5156
8 changed files with 184 additions and 6 deletions
57
scripts/PivotMover.gd
Normal file
57
scripts/PivotMover.gd
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
extends Node3D
|
||||
#class_name
|
||||
#Authored by Tom. Please consult for any modifications or major feature requests.
|
||||
|
||||
#region Variables
|
||||
#Signals
|
||||
|
||||
#Enums
|
||||
|
||||
#Constants
|
||||
|
||||
#Exported Variables
|
||||
#@export_group("Group")
|
||||
#@export_subgroup("Subgroup")
|
||||
@export var rotation_speed : float = 20 #degrees per second
|
||||
@export var height_speed : float = 0.5 # m per second
|
||||
|
||||
#Onready Variables
|
||||
|
||||
#Other Variables (please try to separate and organise!)
|
||||
var target_rotation : float = 0
|
||||
var target_height : float = 3.445
|
||||
|
||||
#endregion
|
||||
|
||||
#region Godot methods
|
||||
func _ready():
|
||||
#Runs when all children have entered the tree
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
if abs(rotation_degrees.y - target_rotation) < 1:
|
||||
rotation_degrees.y = target_rotation
|
||||
else:
|
||||
if(target_rotation > rotation_degrees.y):
|
||||
rotation_degrees.y += rotation_speed * delta
|
||||
else:
|
||||
rotation_degrees.y -= rotation_speed * delta
|
||||
pass
|
||||
#endregion
|
||||
|
||||
#region Signal methods
|
||||
|
||||
func _on_twitch_link_rotate_camera(direction, amount):
|
||||
var dir
|
||||
match direction:
|
||||
"left" : dir = -1
|
||||
"right" : dir = 1
|
||||
target_rotation += dir * float(amount)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other methods (please try to separate and organise!)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
@ -31,11 +31,10 @@ func _ready():
|
|||
#Runs when all children have entered the tree
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
#Runs per frame
|
||||
pass
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Signal methods
|
||||
func _on_twitch_link_move_block(direction, amount):
|
||||
var dir : Vector3
|
||||
|
|
@ -66,7 +65,8 @@ func _on_twitch_link_drop_block():
|
|||
|
||||
|
||||
func _on_twitch_link_start_turn():
|
||||
position = Vector3(0,3,0)
|
||||
position = Vector3(0,2.28,0)
|
||||
rotation_degrees = Vector3(0,0,0)
|
||||
current_block = block_scene.instantiate()
|
||||
current_block.freeze = true
|
||||
add_child(current_block)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue