added camera obejct taking pictures
This commit is contained in:
parent
0b7dd792c8
commit
a3833e2e47
20 changed files with 466 additions and 8 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
[gd_scene format=3 uid="uid://dc7d5v6quedhk"]
|
[gd_scene load_steps=0 format=3 uid="uid://bmwgqig47nlbb"]
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|
|
||||||
3
Florian/AllaroundTheWorld.tscn
Normal file
3
Florian/AllaroundTheWorld.tscn
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[gd_scene format=3 uid="uid://dkvkfna14kln7"]
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D"]
|
||||||
87
Florian/PlayerRigidbody.tscn
Normal file
87
Florian/PlayerRigidbody.tscn
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://crrco762ow56c"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://c35h32dniya44" path="res://Florian/playerRigidbody.gd" id="1_7u3v3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://4hac7s0wvoye" path="res://Florian/cool_camera.tscn" id="2_leq5j"]
|
||||||
|
|
||||||
|
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_jbuyh"]
|
||||||
|
friction = 0.0
|
||||||
|
|
||||||
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_qqgab"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_n7bvk"]
|
||||||
|
|
||||||
|
[node name="PlayerRigidbody" type="RigidBody3D"]
|
||||||
|
disable_mode = 2
|
||||||
|
axis_lock_angular_x = true
|
||||||
|
axis_lock_angular_y = true
|
||||||
|
axis_lock_angular_z = true
|
||||||
|
mass = 20.0
|
||||||
|
physics_material_override = SubResource("PhysicsMaterial_jbuyh")
|
||||||
|
custom_integrator = true
|
||||||
|
continuous_cd = true
|
||||||
|
script = ExtResource("1_7u3v3")
|
||||||
|
|
||||||
|
[node name="BoundingBox" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0509262, 0)
|
||||||
|
shape = SubResource("CylinderShape3D_qqgab")
|
||||||
|
|
||||||
|
[node name="RotationHelper" type="Node3D" parent="BoundingBox"]
|
||||||
|
|
||||||
|
[node name="Interact" type="Node3D" parent="BoundingBox/RotationHelper"]
|
||||||
|
|
||||||
|
[node name="InteractRay" type="RayCast3D" parent="BoundingBox/RotationHelper/Interact"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||||
|
target_position = Vector3(0, 0, -4)
|
||||||
|
collide_with_areas = true
|
||||||
|
collide_with_bodies = false
|
||||||
|
debug_shape_thickness = 1
|
||||||
|
|
||||||
|
[node name="CoolCamera" parent="BoundingBox/RotationHelper" instance=ExtResource("2_leq5j")]
|
||||||
|
|
||||||
|
[node name="ThirdPerson" type="Node3D" parent="BoundingBox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 1.94907, 3)
|
||||||
|
|
||||||
|
[node name="FirstPerson" type="Node3D" parent="BoundingBox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||||
|
|
||||||
|
[node name="FloorChecks" type="Node3D" parent="BoundingBox"]
|
||||||
|
|
||||||
|
[node name="Diagonals" type="Node3D" parent="BoundingBox/FloorChecks"]
|
||||||
|
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay" type="RayCast3D" parent="BoundingBox/FloorChecks/Diagonals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.45)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay2" type="RayCast3D" parent="BoundingBox/FloorChecks/Diagonals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.45)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay4" type="RayCast3D" parent="BoundingBox/FloorChecks/Diagonals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.45, 0, 0)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay3" type="RayCast3D" parent="BoundingBox/FloorChecks/Diagonals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.45, 0, 0)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="Cardinals" type="Node3D" parent="BoundingBox/FloorChecks"]
|
||||||
|
|
||||||
|
[node name="FloorRay" type="RayCast3D" parent="BoundingBox/FloorChecks/Cardinals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.45)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay2" type="RayCast3D" parent="BoundingBox/FloorChecks/Cardinals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.45)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay4" type="RayCast3D" parent="BoundingBox/FloorChecks/Cardinals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.45, 0, 0)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="FloorRay3" type="RayCast3D" parent="BoundingBox/FloorChecks/Cardinals"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.45, 0, 0)
|
||||||
|
target_position = Vector3(0, -1.1, 0)
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
mesh = SubResource("CapsuleMesh_n7bvk")
|
||||||
BIN
Florian/cat.jpg
Normal file
BIN
Florian/cat.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
35
Florian/cat.jpg.import
Normal file
35
Florian/cat.jpg.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b3y733ngio1nx"
|
||||||
|
path.s3tc="res://.godot/imported/cat.jpg-63f722852b826a4e9490fdc6ae6fc912.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Florian/cat.jpg"
|
||||||
|
dest_files=["res://.godot/imported/cat.jpg-63f722852b826a4e9490fdc6ae6fc912.s3tc.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
||||||
14
Florian/cool_camera.gd
Normal file
14
Florian/cool_camera.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
extends Node3D
|
||||||
|
@onready var label: Label = $Control/Label
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("take_picture"):
|
||||||
|
print("Taking Picture!!!")
|
||||||
|
var points_string = ""
|
||||||
|
var total_points = 0
|
||||||
|
for takeable in PictureTakeablesArray.picture_takables:
|
||||||
|
print("Checking takeable")
|
||||||
|
if takeable.picture_taken():
|
||||||
|
points_string += "%s %d\n" % [str(takeable.point_id), int(takeable.points_worth)]
|
||||||
|
total_points += takeable.points_worth
|
||||||
|
label.text = "%s\nTotal points: %d" % [points_string, total_points]
|
||||||
1
Florian/cool_camera.gd.uid
Normal file
1
Florian/cool_camera.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dff1mtnypemb4
|
||||||
22
Florian/cool_camera.tscn
Normal file
22
Florian/cool_camera.tscn
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://4hac7s0wvoye"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dff1mtnypemb4" path="res://Florian/cool_camera.gd" id="1_87r7f"]
|
||||||
|
|
||||||
|
[node name="CoolCamera" type="Node3D"]
|
||||||
|
script = ExtResource("1_87r7f")
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Control"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 559.0
|
||||||
|
offset_bottom = 250.0
|
||||||
|
text = "Points worth: 0"
|
||||||
74
Florian/node_3d.tscn
Normal file
74
Florian/node_3d.tscn
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
[gd_scene load_steps=9 format=3 uid="uid://d1rip77vefx3i"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b3y733ngio1nx" path="res://Florian/cat.jpg" id="1_a202f"]
|
||||||
|
[ext_resource type="Script" uid="uid://bc47hy67mfo7v" path="res://Florian/sprite_3d.gd" id="2_a0tk4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crrco762ow56c" path="res://Florian/PlayerRigidbody.tscn" id="2_noarx"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c8gnb0kut2n5h" path="res://Florian/point_thing.tscn" id="4_ylvgl"]
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eral8"]
|
||||||
|
albedo_color = Color(0.243542, 0.196121, 0.0639371, 1)
|
||||||
|
|
||||||
|
[sub_resource type="PlaneMesh" id="PlaneMesh_4xowi"]
|
||||||
|
material = SubResource("StandardMaterial3D_eral8")
|
||||||
|
size = Vector2(500, 500)
|
||||||
|
|
||||||
|
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_a202f"]
|
||||||
|
|
||||||
|
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_a0tk4"]
|
||||||
|
friction = 0.0
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
mesh = SubResource("PlaneMesh_4xowi")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
|
||||||
|
shape = SubResource("WorldBoundaryShape3D_a202f")
|
||||||
|
|
||||||
|
[node name="Sprite3D" type="Sprite3D" parent="MeshInstance3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0)
|
||||||
|
texture = ExtResource("1_a202f")
|
||||||
|
script = ExtResource("2_a0tk4")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.829857, 0.557977, 0, -0.557977, 0.829857, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="PlayerRigidbody" parent="." instance=ExtResource("2_noarx")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.187409, 7, 11.0325)
|
||||||
|
physics_material_override = SubResource("PhysicsMaterial_a0tk4")
|
||||||
|
|
||||||
|
[node name="CSG" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="House1" type="Node3D" parent="CSG"]
|
||||||
|
|
||||||
|
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="CSG/House1"]
|
||||||
|
use_collision = true
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 2.5, -13)
|
||||||
|
size = Vector3(22, 6, 1)
|
||||||
|
|
||||||
|
[node name="CSGBox3D4" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 2.5, -36)
|
||||||
|
size = Vector3(22, 6, 1)
|
||||||
|
|
||||||
|
[node name="CSGBox3D6" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 5, -24.5)
|
||||||
|
size = Vector3(22, 1, 24)
|
||||||
|
|
||||||
|
[node name="CSGBox3D5" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 12.5, -4.25, -7.57661)
|
||||||
|
size = Vector3(4, 37, 1)
|
||||||
|
|
||||||
|
[node name="CSGBox3D2" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 2.5, -24.5)
|
||||||
|
size = Vector3(1, 6, 24)
|
||||||
|
|
||||||
|
[node name="CSGBox3D3" type="CSGBox3D" parent="CSG/House1/CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11, 2.5, -24.5)
|
||||||
|
size = Vector3(1, 6, 24)
|
||||||
|
|
||||||
|
[node name="PointThing" parent="." instance=ExtResource("4_ylvgl")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 1, 5)
|
||||||
150
Florian/playerRigidbody.gd
Normal file
150
Florian/playerRigidbody.gd
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
class_name PlayerRB
|
||||||
|
extends RigidBody3D
|
||||||
|
|
||||||
|
@onready var camera = $BoundingBox/RotationHelper/CoolCamera
|
||||||
|
@onready var rotation_helper = $BoundingBox/RotationHelper
|
||||||
|
@onready var bounding_box = $BoundingBox
|
||||||
|
|
||||||
|
signal take_picture
|
||||||
|
|
||||||
|
var max_speed = 10
|
||||||
|
var acceleration = max_speed * 10
|
||||||
|
var max_air_speed = 1
|
||||||
|
var air_acceleration = max_speed * 20
|
||||||
|
|
||||||
|
var friction = 16
|
||||||
|
|
||||||
|
var jump_velocity = 5
|
||||||
|
|
||||||
|
|
||||||
|
var currentSpeed = 0
|
||||||
|
var vel : Vector3
|
||||||
|
#var friction : Vector3
|
||||||
|
|
||||||
|
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||||
|
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||||
|
|
||||||
|
var MOUSE_SENSITIVITY = 0.001
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
print("READY!")
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
pass
|
||||||
|
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventKey:
|
||||||
|
if event.keycode == KEY_ESCAPE && event.is_pressed():
|
||||||
|
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
else:
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
|
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
|
||||||
|
rotation_helper.rotate_x(-deg_to_rad(event.relative.y * MOUSE_SENSITIVITY * 50))
|
||||||
|
#print(event.relative.x * MOUSE_SENSITIVITY * -1)
|
||||||
|
bounding_box.rotate_y(event.relative.x * MOUSE_SENSITIVITY * -1)
|
||||||
|
#rotation_helper.rotate_y(deg_to_rad(event.relative.x * MOUSE_SENSITIVITY * -1))
|
||||||
|
#var camera_rot = rotation_helper.rotation_degrees
|
||||||
|
#camera_rot.x = clamp(camera_rot.x, -70, 70)
|
||||||
|
#rotation_helper.rotation_degrees = camera_rot
|
||||||
|
|
||||||
|
if event is InputEventKey:
|
||||||
|
#print(event.as_text_keycode())
|
||||||
|
if event.as_text_keycode() == "T":
|
||||||
|
camera.transform = $BoundingBox/ThirdPerson.transform
|
||||||
|
elif event.as_text_keycode() == "F":
|
||||||
|
camera.transform = $BoundingBox/FirstPerson.transform
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
# Add the gravity.
|
||||||
|
|
||||||
|
# Handle Jump.
|
||||||
|
if Input.is_action_pressed("jump") and is_on_floor():
|
||||||
|
linear_velocity.y = jump_velocity
|
||||||
|
|
||||||
|
var fB = 0 - Input.get_action_strength("forward") + Input.get_action_strength("backward", 1)
|
||||||
|
var lR = 0 - Input.get_action_strength("left", 1) + Input.get_action_strength("right", 1)
|
||||||
|
# Get the input direction and handle the movement/deceleration.
|
||||||
|
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||||
|
var input_dir : Vector3 = Vector3(lR, 0, fB).rotated(Vector3.UP, bounding_box.rotation.y)
|
||||||
|
|
||||||
|
var wishDir = input_dir.normalized()
|
||||||
|
|
||||||
|
currentSpeed = linear_velocity.dot(wishDir)
|
||||||
|
#print("Current speed: ", currentSpeed)
|
||||||
|
#print(currentSpeed)
|
||||||
|
|
||||||
|
if not is_on_floor() or Input.is_action_pressed("jump"):
|
||||||
|
linear_velocity.y -= gravity * delta #speed in the air
|
||||||
|
var addSpeed = clamp(max_air_speed - currentSpeed, 0, air_acceleration * delta)
|
||||||
|
#print(addSpeed)
|
||||||
|
linear_velocity += wishDir * addSpeed
|
||||||
|
else:
|
||||||
|
applyFriction(delta) #speed on floor
|
||||||
|
var addSpeed = clamp(max_speed - currentSpeed, 0, acceleration * delta)
|
||||||
|
linear_velocity += wishDir * addSpeed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#print(Vector3(linear_velocity.x, 0, linear_velocity.z).length())
|
||||||
|
|
||||||
|
|
||||||
|
func applyFriction(delta):
|
||||||
|
|
||||||
|
linear_velocity.x = lerp(linear_velocity.x, 0.0, delta * friction)
|
||||||
|
linear_velocity.z = lerp(linear_velocity.z, 0.0, delta * friction)
|
||||||
|
return vel
|
||||||
|
|
||||||
|
@onready var floor_checks = $BoundingBox/FloorChecks
|
||||||
|
|
||||||
|
|
||||||
|
var slope_limit_degrees = 45.0
|
||||||
|
var slope_limit_dot = cos(deg_to_rad(slope_limit_degrees))
|
||||||
|
|
||||||
|
func is_on_floor() -> bool:
|
||||||
|
for directions in floor_checks.get_children():
|
||||||
|
for floor_ray in directions.get_children():
|
||||||
|
if floor_ray.is_colliding():
|
||||||
|
var normal = floor_ray.get_collision_normal()
|
||||||
|
#print(floor_ray.get_collider())
|
||||||
|
if(normal.dot(Vector3.UP) >= slope_limit_dot):
|
||||||
|
return true
|
||||||
|
continue
|
||||||
|
return false
|
||||||
|
|
||||||
|
const MAX_STANDABLE_ANGLE = deg_to_rad(45)
|
||||||
|
const GROUND_CHECK_DISTANCE = 0.1
|
||||||
|
|
||||||
|
#func _check_on_ground() -> void:
|
||||||
|
#var space_state = get_world_3d().direct_space_state
|
||||||
|
#
|
||||||
|
## Raycast straight down from the player
|
||||||
|
#var from = global_transform.origin
|
||||||
|
#var to = from - Vector3.UP * (GROUND_CHECK_DISTANCE + 2)#get_shape_radius())
|
||||||
|
#
|
||||||
|
#var result = space_state.intersect_ray(
|
||||||
|
#PhysicsRayQueryParameters3D(
|
||||||
|
#
|
||||||
|
#)
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#if result:
|
||||||
|
#ground_normal = result.normal
|
||||||
|
#
|
||||||
|
## Check slope angle
|
||||||
|
#var slope_angle = acos(clamp(ground_normal.dot(Vector3.UP), -1.0, 1.0))
|
||||||
|
#var slope_ok = slope_angle <= MAX_STANDABLE_ANGLE
|
||||||
|
#
|
||||||
|
## Check vertical velocity (like TF2: can't be going upward much)
|
||||||
|
#var vertical_vel_ok = linear_velocity.y <= 0.1
|
||||||
|
#
|
||||||
|
## Final check
|
||||||
|
#is_on_ground = slope_ok and vertical_vel_ok
|
||||||
|
#else:
|
||||||
|
#is_on_ground = false
|
||||||
1
Florian/playerRigidbody.gd.uid
Normal file
1
Florian/playerRigidbody.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c35h32dniya44
|
||||||
12
Florian/point_thing.gd
Normal file
12
Florian/point_thing.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
class_name PointPicture
|
||||||
|
extends Node3D
|
||||||
|
@onready var on_screen: VisibleOnScreenNotifier3D = $VisibleOnScreenNotifier3D
|
||||||
|
@export var points_worth = 10
|
||||||
|
@export var point_id = "Debug Object"
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
PictureTakeablesArray._add_point_picture(self)
|
||||||
|
|
||||||
|
func picture_taken() -> bool:
|
||||||
|
print(on_screen.is_on_screen())
|
||||||
|
return on_screen.is_on_screen()
|
||||||
1
Florian/point_thing.gd.uid
Normal file
1
Florian/point_thing.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cyw0eu5pqd3wm
|
||||||
13
Florian/point_thing.tscn
Normal file
13
Florian/point_thing.tscn
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c8gnb0kut2n5h"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cyw0eu5pqd3wm" path="res://Florian/point_thing.gd" id="1_hr556"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_hr556"]
|
||||||
|
|
||||||
|
[node name="PointThing" type="Node3D"]
|
||||||
|
script = ExtResource("1_hr556")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
mesh = SubResource("BoxMesh_hr556")
|
||||||
|
|
||||||
|
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="."]
|
||||||
4
Florian/sprite_3d.gd
Normal file
4
Florian/sprite_3d.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
extends Sprite3D
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
self.position.x += 0.1
|
||||||
1
Florian/sprite_3d.gd.uid
Normal file
1
Florian/sprite_3d.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bc47hy67mfo7v
|
||||||
8
picture_takeables_array.gd
Normal file
8
picture_takeables_array.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var picture_takables : Array[PointPicture] = []
|
||||||
|
|
||||||
|
func _add_point_picture(point_picture: PointPicture):
|
||||||
|
print("Adding picture takeable")
|
||||||
|
picture_takables.append(point_picture)
|
||||||
|
print(len(picture_takables))
|
||||||
1
picture_takeables_array.gd.uid
Normal file
1
picture_takeables_array.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://baxs3gpdthwf1
|
||||||
|
|
@ -11,5 +11,43 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="AllAroundTheWorld"
|
config/name="AllAroundTheWorld"
|
||||||
|
run/main_scene="uid://d1rip77vefx3i"
|
||||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
config/features=PackedStringArray("4.4", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
PictureTakeablesArray="*res://picture_takeables_array.gd"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
forward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
backward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
left={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
right={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
jump={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
take_picture={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
[gd_scene format=3 uid="uid://cb5cav8r8f47b"]
|
|
||||||
|
|
||||||
[node name="VehicleBody3D" type="VehicleBody3D"]
|
|
||||||
|
|
||||||
[node name="CSG" type="Node3D" parent="."]
|
|
||||||
|
|
||||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSG"]
|
|
||||||
Loading…
Add table
Reference in a new issue