Add camera lock

This commit is contained in:
Spencer Killen 2023-08-19 11:51:06 -06:00
parent 4f01afff2f
commit 86b796b09f
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
6 changed files with 11 additions and 12 deletions

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://dd64j7xcfl6io"] [gd_scene load_steps=6 format=3 uid="uid://cdm267rtmop75"]
[ext_resource type="PackedScene" uid="uid://csqyxbjumla33" path="res://player.tscn" id="1_jbc4n"] [ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="1_jbc4n"]
[ext_resource type="PackedScene" uid="uid://cnnsy8h0dq5y1" path="res://villager.tscn" id="2_i3gws"] [ext_resource type="PackedScene" uid="uid://dl4g083w17qh1" path="res://villager.tscn" id="2_i3gws"]
[ext_resource type="PackedScene" uid="uid://rn1bmw0lf1lr" path="res://cultist.tscn" id="3_renxb"] [ext_resource type="PackedScene" uid="uid://e0s4phx2jiit" path="res://cultist.tscn" id="3_renxb"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_62oje"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_62oje"]
radius = 80.229 radius = 80.229

View File

@ -26,15 +26,13 @@ func _input(event):
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
rotate_y(deg_to_rad(-event.relative.x * horiz_sens)) rotate_y(deg_to_rad(-event.relative.x * horiz_sens))
playerCam.rotate_x(deg_to_rad(-event.relative.y * vert_sens)) playerCam.rotate_x(deg_to_rad(-event.relative.y * vert_sens))
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11))
func _physics_process(delta): func _physics_process(delta):
# Add the gravity. # Add the gravity.
if not is_on_floor(): if not is_on_floor():
velocity.y -= gravity * delta velocity.y -= gravity * delta
# Handle Jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration. # Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions. # As good practice, you should replace UI actions with custom gameplay actions.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://rn1bmw0lf1lr"] [gd_scene load_steps=5 format=3 uid="uid://e0s4phx2jiit"]
[ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"] [ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://csqyxbjumla33"] [gd_scene load_steps=6 format=3 uid="uid://7utef1nnena8"]
[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"] [ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"]
[ext_resource type="Texture2D" uid="uid://vw0x1higed4d" path="res://Default Orange.png" id="2_s5i4o"] [ext_resource type="Texture2D" uid="uid://vw0x1higed4d" path="res://Default Orange.png" id="2_s5i4o"]
@ -24,5 +24,5 @@ surface_material_override/0 = SubResource("StandardMaterial3D_npbs0")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
[node name="PlayerCam" type="Camera3D" parent="CameraMount"] [node name="PlayerCam" type="Camera3D" parent="CameraMount"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 11.9417)
fov = 105.5 fov = 50.0

View File

@ -24,6 +24,7 @@ window/stretch/mode="viewport"
window/stretch/aspect="expand" window/stretch/aspect="expand"
[dotnet] [dotnet]
project/assembly_name="abgj23" project/assembly_name="abgj23"
[filesystem] [filesystem]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://cnnsy8h0dq5y1"] [gd_scene load_steps=4 format=3 uid="uid://dl4g083w17qh1"]
[ext_resource type="Script" path="res://Villager.gd" id="1_ardgw"] [ext_resource type="Script" path="res://Villager.gd" id="1_ardgw"]