Camera Implementation

Very Basic
This commit is contained in:
ncusimano 2023-08-18 21:27:39 -06:00
parent 7644862ffa
commit 5b8fb7b298
9 changed files with 198 additions and 4 deletions

16
godot/CameraTest.tscn Normal file
View File

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3 uid="uid://dd64j7xcfl6io"]
[ext_resource type="PackedScene" uid="uid://csqyxbjumla33" path="res://player.tscn" id="1_i6frr"]
[sub_resource type="BoxShape3D" id="BoxShape3D_r81py"]
size = Vector3(10, 1, 10)
[node name="Node3D" type="Node3D"]
[node name="Player" parent="." instance=ExtResource("1_i6frr")]
[node name="RigidBody3D" type="RigidBody3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -5, 0)
shape = SubResource("BoxShape3D_r81py")

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b0je4d0hkwh33"
path="res://.godot/imported/ExoticPalmBaby.fbx-18609796ca21ea31d02469d5ce4b3a8d.scn"
[deps]
source_file="res://Models/ExoticPalmBaby.fbx"
dest_files=["res://.godot/imported/ExoticPalmBaby.fbx-18609796ca21ea31d02469d5ce4b3a8d.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://br02kcb2orkru"
path="res://.godot/imported/ExoticPalmCurve.fbx-f171d43633fcb2564ec85725bdc79e46.scn"
[deps]
source_file="res://Models/ExoticPalmCurve.fbx"
dest_files=["res://.godot/imported/ExoticPalmCurve.fbx-f171d43633fcb2564ec85725bdc79e46.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cwprqiadeagdy"
path="res://.godot/imported/ExoticPalmDefalt.fbx-7992e041312168fc1e24b073b220a6b7.scn"
[deps]
source_file="res://Models/ExoticPalmDefalt.fbx"
dest_files=["res://.godot/imported/ExoticPalmDefalt.fbx-7992e041312168fc1e24b073b220a6b7.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://c8clfgxi041an"
path="res://.godot/imported/ExoticPalmOld.fbx-bcb78e65808546f55f4d71f474979326.scn"
[deps]
source_file="res://Models/ExoticPalmOld.fbx"
dest_files=["res://.godot/imported/ExoticPalmOld.fbx-bcb78e65808546f55f4d71f474979326.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dhimbtdsktc5s"
path="res://.godot/imported/ExoticPalmYoung.fbx-0de6081591e7c224a5fccf5cd1669985.scn"
[deps]
source_file="res://Models/ExoticPalmYoung.fbx"
dest_files=["res://.godot/imported/ExoticPalmYoung.fbx-0de6081591e7c224a5fccf5cd1669985.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@ -3,10 +3,20 @@ extends CharacterBody3D
const SPEED = 5.0
const JUMP_VELOCITY = 4.5
var playerCam
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
playerCam = get_node("CameraMount") as Node3D
func _input(event):
# Handle the rotation of the camera using mouse movement.
if event is InputEventMouseMotion:
playerCam.rotate_y(deg_to_rad(-event.relative.x))
playerCam.rotate_x(deg_to_rad(event.relative.y))
func _physics_process(delta):
# Add the gravity.

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://dbqnafgsttwth"]
[gd_scene load_steps=6 format=3 uid="uid://csqyxbjumla33"]
[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"]
[ext_resource type="Texture2D" uid="uid://d3lvqr08li31r" path="res://Default Orange.png" id="2_s5i4o"]
[ext_resource type="Texture2D" path="res://Default Orange.png" id="2_s5i4o"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"]
@ -20,6 +20,9 @@ shape = SubResource("CapsuleShape3D_kb4ms")
mesh = SubResource("CapsuleMesh_1e11l")
surface_material_override/0 = SubResource("StandardMaterial3D_npbs0")
[node name="PlayerCam" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
[node name="CameraMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
[node name="PlayerCam" type="Camera3D" parent="CameraMount"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 5)
fov = 105.5

View File

@ -11,9 +11,14 @@ config_version=5
[application]
config/name="abgj23"
run/main_scene="res://CameraTest.tscn"
config/features=PackedStringArray("4.1", "Forward Plus")
config/icon="res://icon.svg"
[dotnet]
project/assembly_name="abgj23"
[filesystem]
import/fbx/enabled=false