точно есть дэшм
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
extends Node3D
|
||||
|
||||
#Camera recoil variables
|
||||
var currentRotation : Vector3
|
||||
var targetRotation : Vector3
|
||||
var baseRotationSpeed : float
|
||||
var targetRotationSpeed : float
|
||||
|
||||
func _process(delta):
|
||||
handleRecoil(delta)
|
||||
|
||||
func handleRecoil(delta):
|
||||
#first phase, the camera will aim according the recoil values
|
||||
#second phase, the camera back down to her initial rotation value
|
||||
targetRotation = lerp(targetRotation, Vector3.ZERO, baseRotationSpeed * delta)
|
||||
currentRotation = lerp(currentRotation, targetRotation, targetRotationSpeed * delta)
|
||||
|
||||
rotation = currentRotation
|
||||
|
||||
func setRecoilValues(baseRotSpeed : float, targRotSpeed : int):
|
||||
baseRotationSpeed = baseRotSpeed
|
||||
targetRotationSpeed = targRotSpeed
|
||||
|
||||
func addRecoil(recoilValue):
|
||||
targetRotation += Vector3(recoilValue.x, randf_range(-recoilValue.y, recoilValue.y), randf_range(-recoilValue.z, recoilValue.z))
|
||||
@@ -0,0 +1 @@
|
||||
uid://k7djd8c1xge2
|
||||
@@ -0,0 +1,7 @@
|
||||
extends SubViewport
|
||||
|
||||
var screenSize : Vector2
|
||||
|
||||
func _ready():
|
||||
screenSize = get_window().size
|
||||
size = screenSize
|
||||
@@ -0,0 +1 @@
|
||||
uid://bt4lvwbcabtef
|
||||
@@ -0,0 +1,6 @@
|
||||
extends Camera3D
|
||||
|
||||
@onready var mainCam : Camera3D = %Camera
|
||||
|
||||
func _process(_delta: float):
|
||||
if mainCam != null: global_transform = mainCam.global_transform
|
||||
@@ -0,0 +1 @@
|
||||
uid://dvfp5mk7fbsbl
|
||||
Reference in New Issue
Block a user