Camera mouse look and trees
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
extends Camera3D
|
||||
extends CharacterBody3D
|
||||
|
||||
@export var velocity: Vector3
|
||||
@export var acceleration: Vector3
|
||||
var g : float = 0.01
|
||||
@export var mouse_sensitivity : float = 0.01
|
||||
var g : float = 0.006
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
global_position = Vector3(0,0,-150)
|
||||
global_position = Vector3(0,0,-4000)
|
||||
acceleration = -global_position.normalized()
|
||||
velocity = Vector3(0.5, 0.5, 0)
|
||||
velocity = Vector3(1.3, 1.8, 0)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@ -17,4 +17,11 @@ func _process(delta):
|
||||
velocity += acceleration
|
||||
global_translate(velocity)
|
||||
Global.camera_position = global_position
|
||||
look_at(Vector3(0,0,0))
|
||||
print(get_slide_collision_count())
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
rotate_y(-event.relative.x * mouse_sensitivity)
|
||||
$Pivot.rotate_x(-event.relative.y * mouse_sensitivity)
|
||||
$Pivot.rotation.x = clamp($Pivot.rotation.x, -1.2, 1.2)
|
||||
|
Reference in New Issue
Block a user