Rendering how I want for now
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"godotTools.editorPath.godot4": "/var/lib/flatpak/app/org.godotengine.Godot/current/active/export/bin/org.godotengine.Godot",
|
"godotTools.editorPath.godot4": "/var/lib/flatpak/app/org.godotengine.Godot/current/active/export/bin/org.godotengine.Godot",
|
||||||
"terminal.integrated.tabs.enabled": false,
|
"terminal.integrated.tabs.enabled": false,
|
||||||
"editor.insertSpaces": false,
|
"editor.insertSpaces": true,
|
||||||
"editor.tabSize": 4,
|
"editor.tabSize": 2,
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/*.uid": true
|
"**/*.uid": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,82 +2,20 @@
|
|||||||
class_name EntityMovement extends Node
|
class_name EntityMovement extends Node
|
||||||
|
|
||||||
const FRICTION = 0.01
|
const FRICTION = 0.01
|
||||||
|
const WALK_SPEED_DEFAULT = 8
|
||||||
enum FacingDirection {
|
const RUN_SPEED_DEFAULT = 12
|
||||||
SOUTH = 0,
|
|
||||||
EAST = 1,
|
|
||||||
NORTH = 2,
|
|
||||||
WEST = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
const FacingDirWalkAnimations = {
|
|
||||||
FacingDirection.SOUTH: "walk_south",
|
|
||||||
FacingDirection.EAST: "walk_east",
|
|
||||||
FacingDirection.NORTH: "walk_north",
|
|
||||||
FacingDirection.WEST: "walk_west"
|
|
||||||
};
|
|
||||||
|
|
||||||
const FacingDirAngle = {
|
|
||||||
FacingDirection.SOUTH: 0.0,
|
|
||||||
FacingDirection.EAST: PI / 2,
|
|
||||||
FacingDirection.NORTH: PI,
|
|
||||||
FacingDirection.WEST: -PI / 2
|
|
||||||
};
|
|
||||||
|
|
||||||
var _inputDir:Vector2 = Vector2.ZERO
|
var _inputDir:Vector2 = Vector2.ZERO
|
||||||
var _facingDir:FacingDirection = FacingDirection.SOUTH
|
|
||||||
var _running:bool = false
|
var _running:bool = false
|
||||||
|
|
||||||
@export var body:CharacterBody3D
|
@export var body:CharacterBody3D
|
||||||
@export var rotate:Node3D
|
@export var rotate:Node3D
|
||||||
@export var sprite:AnimatedSprite3D
|
@export var walkSpeed:float = WALK_SPEED_DEFAULT
|
||||||
@export var walkSpeed:float = 48.0
|
@export var runSpeed:float = RUN_SPEED_DEFAULT
|
||||||
@export var runSpeed:float = 64.0
|
|
||||||
@export var facingDir:FacingDirection = FacingDirection.SOUTH:
|
|
||||||
set(value):
|
|
||||||
_facingDir = value
|
|
||||||
_updateSprite()
|
|
||||||
get:
|
|
||||||
return _facingDir
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Private Methods
|
# Private Methods
|
||||||
#
|
#
|
||||||
func _updateSprite() -> void:
|
|
||||||
if !sprite || sprite.animation == FacingDirWalkAnimations[facingDir]:
|
|
||||||
return
|
|
||||||
sprite.animation = FacingDirWalkAnimations[facingDir]
|
|
||||||
|
|
||||||
|
|
||||||
func _applyFacingDir() -> void:
|
|
||||||
if !sprite || _inputDir.length() <= 0.01:
|
|
||||||
return
|
|
||||||
|
|
||||||
if _inputDir.y > 0:
|
|
||||||
if facingDir != FacingDirection.NORTH && _inputDir.x != 0:
|
|
||||||
if _inputDir.x > 0 && facingDir == FacingDirection.EAST:
|
|
||||||
facingDir = FacingDirection.EAST
|
|
||||||
elif _inputDir.x < 0 && facingDir == FacingDirection.WEST:
|
|
||||||
facingDir = FacingDirection.WEST
|
|
||||||
else:
|
|
||||||
facingDir = FacingDirection.NORTH
|
|
||||||
else:
|
|
||||||
facingDir = FacingDirection.NORTH
|
|
||||||
elif _inputDir.y < 0:
|
|
||||||
if facingDir != FacingDirection.SOUTH && _inputDir.x != 0:
|
|
||||||
if _inputDir.x > 0 && facingDir == FacingDirection.EAST:
|
|
||||||
facingDir = FacingDirection.EAST
|
|
||||||
elif _inputDir.x < 0 && facingDir == FacingDirection.WEST:
|
|
||||||
facingDir = FacingDirection.WEST
|
|
||||||
else:
|
|
||||||
facingDir = FacingDirection.SOUTH
|
|
||||||
else:
|
|
||||||
facingDir = FacingDirection.SOUTH
|
|
||||||
elif _inputDir.x > 0:
|
|
||||||
facingDir = FacingDirection.EAST
|
|
||||||
else:
|
|
||||||
facingDir = FacingDirection.WEST
|
|
||||||
|
|
||||||
func _applyGravity() -> void:
|
func _applyGravity() -> void:
|
||||||
if !body.is_on_floor():
|
if !body.is_on_floor():
|
||||||
body.velocity += PHYSICS.GRAVITY * get_process_delta_time()
|
body.velocity += PHYSICS.GRAVITY * get_process_delta_time()
|
||||||
@@ -132,7 +70,7 @@ func canMove() -> bool:
|
|||||||
# Callbacks
|
# Callbacks
|
||||||
#
|
#
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
_updateSprite()
|
pass
|
||||||
|
|
||||||
func _physics_process(delta:float) -> void:
|
func _physics_process(delta:float) -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
@@ -144,5 +82,4 @@ func _physics_process(delta:float) -> void:
|
|||||||
_applyGravity()
|
_applyGravity()
|
||||||
_applyFriction(delta)
|
_applyFriction(delta)
|
||||||
_applyMovement()
|
_applyMovement()
|
||||||
_applyFacingDir()
|
|
||||||
body.move_and_slide()
|
body.move_and_slide()
|
||||||
|
|||||||
@@ -3,15 +3,6 @@ class_name NPC extends CharacterBody3D
|
|||||||
|
|
||||||
@export var _movement:NPCMovement
|
@export var _movement:NPCMovement
|
||||||
|
|
||||||
@export var facingDirection:EntityMovement.FacingDirection:
|
|
||||||
set(value):
|
|
||||||
if _movement:
|
|
||||||
_movement.facingDir = value
|
|
||||||
get:
|
|
||||||
if _movement:
|
|
||||||
return _movement.facingDir
|
|
||||||
return EntityMovement.FacingDirection.SOUTH
|
|
||||||
|
|
||||||
@export var walkSpeed:float = 48.0:
|
@export var walkSpeed:float = 48.0:
|
||||||
set(value):
|
set(value):
|
||||||
if _movement:
|
if _movement:
|
||||||
|
|||||||
@@ -1,96 +1,48 @@
|
|||||||
[gd_scene load_steps=12 format=3 uid="uid://kabs7mopalmo"]
|
[gd_scene load_steps=8 format=3 uid="uid://kabs7mopalmo"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://crw7ls7t8cwct" path="res://entity/npc/NPC.gd" id="1_00k55"]
|
[ext_resource type="Script" uid="uid://crw7ls7t8cwct" path="res://entity/npc/NPC.gd" id="1_00k55"]
|
||||||
[ext_resource type="Script" uid="uid://b00rxpveu3v4m" path="res://InteractableArea.gd" id="2_x8luf"]
|
[ext_resource type="Script" uid="uid://b00rxpveu3v4m" path="res://InteractableArea.gd" id="2_x8luf"]
|
||||||
[ext_resource type="Script" uid="uid://tlfthv88ki0y" path="res://entity/npc/NPCMovement.gd" id="3_1seh5"]
|
[ext_resource type="Script" uid="uid://tlfthv88ki0y" path="res://entity/npc/NPCMovement.gd" id="3_1seh5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entity/player/Player.png" id="4_x8luf"]
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_1seh5"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jphom"]
|
||||||
size = Vector3(16, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_jphom"]
|
||||||
atlas = ExtResource("4_x8luf")
|
size = Vector3(1, 2, 1)
|
||||||
region = Rect2(16, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jphom"]
|
||||||
atlas = ExtResource("4_x8luf")
|
shading_mode = 0
|
||||||
region = Rect2(48, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ak4un"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_jphom"]
|
||||||
atlas = ExtResource("4_x8luf")
|
material = SubResource("StandardMaterial3D_jphom")
|
||||||
region = Rect2(0, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1ms0h"]
|
|
||||||
atlas = ExtResource("4_x8luf")
|
|
||||||
region = Rect2(32, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_1seh5"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_rl6fg")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_east",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_q57vx")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_north",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ak4un")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_south",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_1ms0h")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_west",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_x8luf"]
|
|
||||||
radius = 8.5
|
|
||||||
|
|
||||||
[node name="NPC" type="CharacterBody3D" node_paths=PackedStringArray("_movement")]
|
[node name="NPC" type="CharacterBody3D" node_paths=PackedStringArray("_movement")]
|
||||||
script = ExtResource("1_00k55")
|
script = ExtResource("1_00k55")
|
||||||
|
facingDirection = null
|
||||||
|
walkSpeed = null
|
||||||
|
runSpeed = null
|
||||||
_movement = NodePath("Scripts/NPCMovement")
|
_movement = NodePath("Scripts/NPCMovement")
|
||||||
|
|
||||||
[node name="Scripts" type="Node" parent="."]
|
[node name="Scripts" type="Node" parent="."]
|
||||||
|
|
||||||
[node name="NPCMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "sprite")]
|
[node name="NPCMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body")]
|
||||||
script = ExtResource("3_1seh5")
|
script = ExtResource("3_1seh5")
|
||||||
body = NodePath("../..")
|
body = NodePath("../..")
|
||||||
sprite = NodePath("../../AnimatedSprite3D")
|
|
||||||
|
|
||||||
[node name="InteractableArea" type="Area3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
shape = SubResource("CapsuleShape3D_jphom")
|
||||||
|
|
||||||
|
[node name="Rotate" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="InteractableArea" type="Area3D" parent="Rotate"]
|
||||||
script = ExtResource("2_x8luf")
|
script = ExtResource("2_x8luf")
|
||||||
metadata/_custom_type_script = "uid://b00rxpveu3v4m"
|
metadata/_custom_type_script = "uid://b00rxpveu3v4m"
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableArea"]
|
[node name="InteractableShape" type="CollisionShape3D" parent="Rotate/InteractableArea"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, 0)
|
transform = Transform3D(0.999999, -0.000856732, 0.0007724, 0.000857588, 0.999999, -0.00114162, -0.000771449, 0.00114226, 0.999999, 0, 0, 0)
|
||||||
shape = SubResource("BoxShape3D_1seh5")
|
shape = SubResource("BoxShape3D_jphom")
|
||||||
|
|
||||||
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."]
|
[node name="CapsuleMesh" type="MeshInstance3D" parent="Rotate"]
|
||||||
pixel_size = 1.0
|
mesh = SubResource("CapsuleMesh_jphom")
|
||||||
axis = 1
|
skeleton = NodePath("../..")
|
||||||
double_sided = false
|
|
||||||
texture_filter = 0
|
|
||||||
sprite_frames = SubResource("SpriteFrames_1seh5")
|
|
||||||
animation = &"walk_south"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[connection signal="interactEvent" from="Rotate/InteractableArea" to="." method="onInteract"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.5, 0)
|
|
||||||
shape = SubResource("SphereShape3D_x8luf")
|
|
||||||
|
|
||||||
[connection signal="interactEvent" from="InteractableArea" to="." method="onInteract"]
|
|
||||||
|
|||||||
@@ -3,29 +3,20 @@ class_name Player extends CharacterBody3D
|
|||||||
|
|
||||||
@export var _movement:PlayerMovement
|
@export var _movement:PlayerMovement
|
||||||
|
|
||||||
@export var facingDirection:EntityMovement.FacingDirection:
|
@export var walkSpeed:float = EntityMovement.WALK_SPEED_DEFAULT:
|
||||||
set(value):
|
|
||||||
if _movement:
|
|
||||||
_movement.facingDir = value
|
|
||||||
get:
|
|
||||||
if _movement:
|
|
||||||
return _movement.facingDir
|
|
||||||
return EntityMovement.FacingDirection.SOUTH
|
|
||||||
|
|
||||||
@export var walkSpeed:float = 48.0:
|
|
||||||
set(value):
|
set(value):
|
||||||
if _movement:
|
if _movement:
|
||||||
_movement.walkSpeed = value
|
_movement.walkSpeed = value
|
||||||
get:
|
get:
|
||||||
if _movement:
|
if _movement:
|
||||||
return _movement.walkSpeed
|
return _movement.walkSpeed
|
||||||
return 48.0
|
return EntityMovement.WALK_SPEED_DEFAULT
|
||||||
|
|
||||||
@export var runSpeed:float = 64.0:
|
@export var runSpeed:float = EntityMovement.RUN_SPEED_DEFAULT:
|
||||||
set(value):
|
set(value):
|
||||||
if _movement:
|
if _movement:
|
||||||
_movement.runSpeed = value
|
_movement.runSpeed = value
|
||||||
get:
|
get:
|
||||||
if _movement:
|
if _movement:
|
||||||
return _movement.runSpeed
|
return _movement.runSpeed
|
||||||
return 64.0
|
return EntityMovement.RUN_SPEED_DEFAULT
|
||||||
|
|||||||
@@ -1,68 +1,29 @@
|
|||||||
[gd_scene load_steps=14 format=3 uid="uid://2ch34sio36nv"]
|
[gd_scene load_steps=12 format=3 uid="uid://2ch34sio36nv"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ylmy3nvpirgr" path="res://entity/player/Player.gd" id="1_24gqh"]
|
[ext_resource type="Script" uid="uid://ylmy3nvpirgr" path="res://entity/player/Player.gd" id="1_24gqh"]
|
||||||
[ext_resource type="Script" uid="uid://bwxdv3kxrs4oj" path="res://entity/player/PlayerMovement.gd" id="2_o7et6"]
|
[ext_resource type="Script" uid="uid://bwxdv3kxrs4oj" path="res://entity/player/PlayerMovement.gd" id="2_o7et6"]
|
||||||
[ext_resource type="Script" uid="uid://b3nty7pvbo58d" path="res://entity/player/PlayerInteraction.gd" id="3_24gqh"]
|
[ext_resource type="Script" uid="uid://b3nty7pvbo58d" path="res://entity/player/PlayerInteraction.gd" id="3_24gqh"]
|
||||||
[ext_resource type="Script" uid="uid://bdv1fj1pwknrs" path="res://entity/player/PlayerInput.gd" id="4_yjynp"]
|
[ext_resource type="Script" uid="uid://bdv1fj1pwknrs" path="res://entity/player/PlayerInput.gd" id="4_yjynp"]
|
||||||
[ext_resource type="Script" uid="uid://bdjgvyiacbg28" path="res://entity/player/PlayerCamera.gd" id="5_g3lhm"]
|
[ext_resource type="Script" uid="uid://bdjgvyiacbg28" path="res://entity/player/PlayerCamera.gd" id="5_g3lhm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entity/player/Player.png" id="7_fmb3c"]
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_4pwj0"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rykwh"]
|
||||||
radius = 8.5
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rykwh"]
|
||||||
atlas = ExtResource("7_fmb3c")
|
shading_mode = 0
|
||||||
region = Rect2(16, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_etv1g"]
|
||||||
atlas = ExtResource("7_fmb3c")
|
material = SubResource("StandardMaterial3D_rykwh")
|
||||||
region = Rect2(48, 0, 16, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ak4un"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_etv1g"]
|
||||||
atlas = ExtResource("7_fmb3c")
|
shading_mode = 0
|
||||||
region = Rect2(0, 0, 16, 16)
|
albedo_color = Color(0.376471, 1, 1, 1)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1ms0h"]
|
[sub_resource type="BoxMesh" id="BoxMesh_m44ds"]
|
||||||
atlas = ExtResource("7_fmb3c")
|
material = SubResource("StandardMaterial3D_etv1g")
|
||||||
region = Rect2(32, 0, 16, 16)
|
size = Vector3(0.4, 0.4, 0.4)
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_2rv2u"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_rl6fg")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_east",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_q57vx")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_north",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ak4un")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_south",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_1ms0h")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_west",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_g13of"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_g13of"]
|
||||||
size = Vector3(10, 16, 8)
|
size = Vector3(1.14069, 1, 1.38867)
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("_movement")]
|
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("_movement")]
|
||||||
script = ExtResource("1_24gqh")
|
script = ExtResource("1_24gqh")
|
||||||
@@ -70,15 +31,14 @@ _movement = NodePath("Scripts/PlayerMovement")
|
|||||||
|
|
||||||
[node name="Scripts" type="Node" parent="."]
|
[node name="Scripts" type="Node" parent="."]
|
||||||
|
|
||||||
[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "rotate", "sprite")]
|
[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "rotate")]
|
||||||
script = ExtResource("2_o7et6")
|
script = ExtResource("2_o7et6")
|
||||||
body = NodePath("../..")
|
body = NodePath("../..")
|
||||||
rotate = NodePath("../../PlayerRotated")
|
rotate = NodePath("../../PlayerRotate")
|
||||||
sprite = NodePath("../../AnimatedSprite3D")
|
|
||||||
|
|
||||||
[node name="PlayerInteraction" type="Node" parent="Scripts" node_paths=PackedStringArray("interactableArea", "player")]
|
[node name="PlayerInteraction" type="Node" parent="Scripts" node_paths=PackedStringArray("interactableArea", "player")]
|
||||||
script = ExtResource("3_24gqh")
|
script = ExtResource("3_24gqh")
|
||||||
interactableArea = NodePath("../../PlayerRotated/PlayerInteractableArea")
|
interactableArea = NodePath("../../PlayerRotate/PlayerInteractableArea")
|
||||||
player = NodePath("../..")
|
player = NodePath("../..")
|
||||||
|
|
||||||
[node name="PlayerInput" type="Node" parent="Scripts" node_paths=PackedStringArray("interaction", "movement")]
|
[node name="PlayerInput" type="Node" parent="Scripts" node_paths=PackedStringArray("interaction", "movement")]
|
||||||
@@ -92,24 +52,23 @@ camera = NodePath("../../PlayerCamera")
|
|||||||
target = NodePath("../..")
|
target = NodePath("../..")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.5, 0)
|
shape = SubResource("CapsuleShape3D_rykwh")
|
||||||
shape = SubResource("SphereShape3D_4pwj0")
|
|
||||||
|
|
||||||
[node name="PlayerCamera" type="Camera3D" parent="."]
|
[node name="PlayerCamera" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, -0.000461383, 0.000263726, 0.000138582, 0.705475, 0.708735, -0.00051305, -0.708735, 0.705475, 0.00619125, 4.26114, 4.36711)
|
||||||
|
|
||||||
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."]
|
[node name="PlayerRotate" type="Node3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0496178, 0, -0.00852585)
|
|
||||||
pixel_size = 1.0
|
|
||||||
axis = 1
|
|
||||||
double_sided = false
|
|
||||||
texture_filter = 0
|
|
||||||
sprite_frames = SubResource("SpriteFrames_2rv2u")
|
|
||||||
animation = &"walk_south"
|
|
||||||
|
|
||||||
[node name="PlayerRotated" type="Node3D" parent="."]
|
[node name="CapsuleMesh" type="MeshInstance3D" parent="PlayerRotate"]
|
||||||
|
mesh = SubResource("CapsuleMesh_etv1g")
|
||||||
|
skeleton = NodePath("../..")
|
||||||
|
|
||||||
[node name="PlayerInteractableArea" type="Area3D" parent="PlayerRotated"]
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="PlayerRotate/CapsuleMesh"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.41166, 0.475431)
|
||||||
|
mesh = SubResource("BoxMesh_m44ds")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerRotated/PlayerInteractableArea"]
|
[node name="PlayerInteractableArea" type="Area3D" parent="PlayerRotate"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, 10)
|
|
||||||
|
[node name="InteractHitbox" type="CollisionShape3D" parent="PlayerRotate/PlayerInteractableArea"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0233459, 0, 0.795664)
|
||||||
shape = SubResource("BoxShape3D_g13of")
|
shape = SubResource("BoxShape3D_g13of")
|
||||||
|
|||||||
@@ -6,28 +6,22 @@ const CAMERA_PIXEL_SCALE = 1.0
|
|||||||
|
|
||||||
@export var camera:Camera3D = null
|
@export var camera:Camera3D = null
|
||||||
@export var target:Node3D = null
|
@export var target:Node3D = null
|
||||||
@export var offset:Vector3 = Vector3(0, 0, 12)
|
|
||||||
|
var angle = 0.0
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if !camera || !target:
|
if !camera || !target:
|
||||||
return
|
return
|
||||||
|
|
||||||
# I tried a few things but this is most consistent for both backbuffer and
|
# Follow target
|
||||||
# framebuffer viewports.
|
# camera.global_transform.origin = target.global_transform.origin
|
||||||
var viewportHeight = get_viewport().get_visible_rect().size.y;
|
|
||||||
var unitScale = CAMERA_PIXEL_SCALE * CAMERA_PIXELS_PER_UNIT;
|
|
||||||
|
|
||||||
var z:float = (
|
# # Spin around origin.
|
||||||
tan((deg_to_rad(180) - deg_to_rad(camera.fov)) / 2.0) *
|
# var rotation_speed = 1 # Radians per second
|
||||||
(viewportHeight / 2.0)
|
# angle += rotation_speed * delta
|
||||||
) / unitScale;
|
# var radius = 3.0
|
||||||
|
# var offset = Vector3(radius * sin(angle), 2.0, radius * cos(angle))
|
||||||
|
# camera.global_transform.origin += offset
|
||||||
|
|
||||||
var look = target.global_position;
|
# # Look at target
|
||||||
var position = offset + look;
|
# camera.look_at(target.global_transform.origin, Vector3.UP)
|
||||||
|
|
||||||
camera.look_at_from_position(
|
|
||||||
Vector3(position.x, position.y + z, position.z),
|
|
||||||
look
|
|
||||||
);
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ script = ExtResource("1_6ms5s")
|
|||||||
[node name="TestMapBase" parent="." instance=ExtResource("1_ox0si")]
|
[node name="TestMapBase" parent="." instance=ExtResource("1_ox0si")]
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("2_0d2qr")]
|
[node name="Player" parent="." instance=ExtResource("2_0d2qr")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.04397, 1.9488, -16.5251)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5777, 1.74123, 0)
|
||||||
facingDirection = 1
|
|
||||||
|
|
||||||
[node name="NPC" parent="." instance=ExtResource("3_0vfw4")]
|
[node name="NPC" parent="." instance=ExtResource("3_0vfw4")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.30029, 4.06806, 0.563562)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.3026, 1.9909, -2.12904)
|
||||||
|
walkSpeed = 48.0
|
||||||
|
runSpeed = 64.0
|
||||||
|
|||||||
@@ -35,10 +35,9 @@ gdscript/warnings/shadowed_variable=0
|
|||||||
|
|
||||||
window/size/viewport_width=480
|
window/size/viewport_width=480
|
||||||
window/size/viewport_height=270
|
window/size/viewport_height=270
|
||||||
window/size/window_width_override=960
|
window/size/window_width_override=1440
|
||||||
window/size/window_height_override=540
|
window/size/window_height_override=810
|
||||||
window/stretch/mode="viewport"
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/scale_mode="integer"
|
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,3 @@ class_name UISingleton extends Control
|
|||||||
|
|
||||||
@export var TEXTBOX: VNTextbox
|
@export var TEXTBOX: VNTextbox
|
||||||
@export var PAUSE: PauseMenu
|
@export var PAUSE: PauseMenu
|
||||||
@onready var MADTALK:Node = $VNTextbox/MadTalk;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user