Compare commits
2 Commits
4f1126563c
..
uurin
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a868aacc0 | |||
| 356003cffd |
Generated
-15
@@ -1,15 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/.idea.Bullosseum.iml
|
||||
/projectSettingsUpdater.xml
|
||||
/contentModel.xml
|
||||
/modules.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
Generated
-4
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
Generated
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
Generated
-6
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,66 @@
|
||||
[gd_scene format=3 uid="uid://crtm0xtiql3r8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bn777gguclud5" path="res://player.gd" id="1_xhfnw"]
|
||||
[ext_resource type="Script" uid="uid://b4td4k8yo5y78" path="res://camera_spring_arm.gd" id="2_kpjcp"]
|
||||
[ext_resource type="Script" uid="uid://b720l6m0ehrj3" path="res://camera_follow.gd" id="3_kne1u"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xhfnw"]
|
||||
size = Vector3(1, 1.4072266, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_0rwas"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_kne1u"]
|
||||
radius = 0.3
|
||||
|
||||
[node name="Player" type="CharacterBody3D" unique_id=165510044]
|
||||
script = ExtResource("1_xhfnw")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1104396769]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.20361328, 0)
|
||||
shape = SubResource("BoxShape3D_xhfnw")
|
||||
|
||||
[node name="CubeGuy" type="Node3D" parent="." unique_id=1651396216]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="CubeGuy" unique_id=367855086]
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="CubeGuy" unique_id=1565560527]
|
||||
transform = Transform3D(0.22778136, 0, 0, 0, 0.4572928, 0, 0, 0, 0.2800231, 0.36544353, -0.65451574, 0)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D3" type="MeshInstance3D" parent="CubeGuy" unique_id=2097296241]
|
||||
transform = Transform3D(0.22778136, 0, 0, 0, 0.4572928, 0, 0, 0, 0.2800231, -0.38543648, -0.65451574, 0)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D4" type="MeshInstance3D" parent="CubeGuy" unique_id=383816037]
|
||||
transform = Transform3D(0.14033328, 0.3601992, 0, -0.17941824, 0.28173247, 0, 0, 0, 0.28002307, -0.60614854, -0.07838535, 0)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D5" type="MeshInstance3D" parent="CubeGuy" unique_id=326472138]
|
||||
transform = Transform3D(-0.14033328, -0.3601992, 2.4480395e-08, -0.17941824, 0.28173247, 0, -1.2268325e-08, -3.1489616e-08, -0.28002307, 0.6122027, -0.07838535, 0)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D6" type="MeshInstance3D" parent="CubeGuy" unique_id=1642768377]
|
||||
transform = Transform3D(-0.113692805, 0, -2.4480393e-08, 0, 0.11736439, 0, 9.939342e-09, 0, -0.28002304, -0.26236355, 0.3103568, 0.42819703)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="MeshInstance3D7" type="MeshInstance3D" parent="CubeGuy" unique_id=695468518]
|
||||
transform = Transform3D(-0.113692805, 0, -2.4480393e-08, 0, 0.11736439, 0, 9.939342e-09, 0, -0.28002304, 0.2908606, 0.28320956, 0.42819703)
|
||||
mesh = SubResource("BoxMesh_0rwas")
|
||||
|
||||
[node name="SpringArmPivot" type="Node3D" parent="." unique_id=1671817680]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.22, 0)
|
||||
script = ExtResource("2_kpjcp")
|
||||
|
||||
[node name="SpringArm3D" type="SpringArm3D" parent="SpringArmPivot" unique_id=141439848]
|
||||
collision_mask = 2
|
||||
shape = SubResource("SphereShape3D_kne1u")
|
||||
spring_length = 7.0
|
||||
|
||||
[node name="SpringPosition" type="Node3D" parent="SpringArmPivot/SpringArm3D" unique_id=1307131677]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="SpringArmPivot" unique_id=1120161087 node_paths=PackedStringArray("spring_arm")]
|
||||
keep_aspect = 0
|
||||
script = ExtResource("3_kne1u")
|
||||
spring_arm = NodePath("../SpringArm3D/SpringPosition")
|
||||
lerp_power = 6.0
|
||||
@@ -6,4 +6,4 @@ extends Camera3D
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
position = position.lerp(spring_arm.position, delta * lerp_power)
|
||||
position = lerp(position, spring_arm.position, delta * lerp_power)
|
||||
@@ -1,30 +1,29 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
@export var mouse_sensitivity: float = 0.005
|
||||
@export_range(-90.0, 0.0, 0.1, "radians_as_degrees") var min_vertical_angle: float = -PI / 2
|
||||
@export_range(0.0, 90.0, 0.1, "radians_as_degrees") var max_vertical_angle: float = PI / 4
|
||||
@export var min_zoom: float = 2.0
|
||||
@export var max_zoom: float = 12.0
|
||||
|
||||
@onready var spring_arm: SpringArm3D = $SpringArm3D
|
||||
@export_range(-90.0, 0.0, 0.1, "radians_as_degrees") var min_vertical_angle: float = -PI/2
|
||||
@export_range(0.0, 90.0, 0.1, "radians_as_degrees") var max_vertical_angle: float = PI/4
|
||||
|
||||
@onready var spring_arm := $SpringArm3D
|
||||
|
||||
func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
rotation.y -= event.relative.x * mouse_sensitivity
|
||||
rotation.y = wrapf(rotation.y, 0.0, TAU)
|
||||
|
||||
rotation.x -= event.relative.y * mouse_sensitivity
|
||||
rotation.x = clamp(rotation.x, min_vertical_angle, max_vertical_angle)
|
||||
|
||||
if event.is_action_pressed("zoom_in"):
|
||||
spring_arm.spring_length = clamp(spring_arm.spring_length - 1.0, min_zoom, max_zoom)
|
||||
if event.is_action_pressed("zoom_out"):
|
||||
spring_arm.spring_length = clamp(spring_arm.spring_length + 1.0, min_zoom, max_zoom)
|
||||
|
||||
if event.is_action_pressed("wheel_up"):
|
||||
spring_arm.spring_length -=1
|
||||
if event.is_action_pressed("wheel_down"):
|
||||
spring_arm.spring_length +=1
|
||||
|
||||
if event.is_action_pressed("toggle_mouse_capture"):
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
@@ -0,0 +1,28 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_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.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
@@ -0,0 +1,41 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="3rd_person_camera"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[input]
|
||||
|
||||
wheel_up={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(726, 8),"global_position":Vector2(735, 56),"factor":1.0,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
wheel_down={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(400, 21),"global_position":Vector2(409, 69),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_mouse_capture={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(461, 22),"global_position":Vector2(470, 70),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
||||
[rendering]
|
||||
|
||||
rendering_device/driver.windows="d3d12"
|
||||
@@ -1,28 +1,30 @@
|
||||
[gd_scene format=3 uid="uid://b7afbx36ltb3f"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crtm0xtiql3r8" path="res://Player.tscn" id="1_ulcgi"]
|
||||
[ext_resource type="PackedScene" uid="uid://dio67r8ambe7h" path="res://Assets/arena_placeholder_v01.glb" id="2_nxogm"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_nxogm"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ulcgi"]
|
||||
size = Vector3(1, 1, 1)
|
||||
|
||||
[node name="scene" type="Node3D" unique_id=22320312]
|
||||
|
||||
[node name="Player" parent="." unique_id=165510044 instance=ExtResource("1_ulcgi")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.3040223, 0)
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=818712731]
|
||||
transform = Transform3D(0.030703627, 0.98235905, -0.18446636, -0.1612905, 0.18700416, 0.9690277, 0.9864293, -1.2735805e-08, 0.16418687, -4.08134, 0.3070748, 0.97087634)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="." unique_id=1081100876]
|
||||
transform = Transform3D(10, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0)
|
||||
transform = Transform3D(3.5710833, 0, 0, 0, 1, 0, 0, 0, 2.2964425, 0, 0, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Node3D" unique_id=1193968330]
|
||||
transform = Transform3D(7.6892195, 0, 0, 0, 0.34217757, 0, 0, 0, 8.638922, 0, 0, 0)
|
||||
mesh = SubResource("BoxMesh_nxogm")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Node3D" unique_id=2072095624]
|
||||
transform = Transform3D(1.0000001, 0, 0, 0, 1.0000001, 0, 0, 0, 1.0000001, 0, 0, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Node3D/StaticBody3D" unique_id=1444198204]
|
||||
transform = Transform3D(30, 0, 0, 0, 1, 0, 0, 0, 30, 0, -0.5, 0)
|
||||
transform = Transform3D(7.6892185, 0, 0, 0, 0.34217754, 0, 0, 0, 8.638921, 0, 0, 0)
|
||||
shape = SubResource("BoxShape3D_ulcgi")
|
||||
|
||||
[node name="arena_placeholder_v01" parent="Node3D" unique_id=1341659233 instance=ExtResource("2_nxogm")]
|
||||
transform = Transform3D(0.28002706, 0, 0, 0, 1, 0, 0, 0, 0.43545616, -0.2506242, 0, 0)
|
||||
Binary file not shown.
@@ -1,42 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dio67r8ambe7h"
|
||||
path="res://.godot/imported/arena_placeholder_v01.glb-fc11365d8ec7ae6778e90b13ba508b8a.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/arena_placeholder_v01.glb"
|
||||
dest_files=["res://.godot/imported/arena_placeholder_v01.glb-fc11365d8ec7ae6778e90b13ba508b8a.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
Binary file not shown.
@@ -1,44 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://qy6qrxdfgx2g"
|
||||
path="res://.godot/imported/bull_v10.fbx-0bb89c99686d56acf88cf41a200f2277.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/bull_v10.fbx"
|
||||
dest_files=["res://.godot/imported/bull_v10.fbx-0bb89c99686d56acf88cf41a200f2277.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=true
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
fbx/importer=0
|
||||
fbx/allow_geometry_helper_nodes=false
|
||||
fbx/embedded_image_handling=1
|
||||
fbx/naming_version=2
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://crtm0xtiql3r8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bn777gguclud5" path="res://player.gd" id="1_xhfnw"]
|
||||
[ext_resource type="Script" uid="uid://b4td4k8yo5y78" path="res://camera_spring_arm.gd" id="2_kpjcp"]
|
||||
[ext_resource type="Script" uid="uid://b720l6m0ehrj3" path="res://camera_follow.gd" id="3_kne1u"]
|
||||
[ext_resource type="PackedScene" uid="uid://qy6qrxdfgx2g" path="res://Assets/bull_v10.fbx" id="4_e80uo"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_cxr5p"]
|
||||
radius = 0.9978615
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_kne1u"]
|
||||
radius = 0.3
|
||||
|
||||
[node name="Player" type="CharacterBody3D" unique_id=165510044]
|
||||
script = ExtResource("1_xhfnw")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1104396769]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06252837, 0.10353303, 0)
|
||||
shape = SubResource("SphereShape3D_cxr5p")
|
||||
|
||||
[node name="SpringArmPivot" type="Node3D" parent="." unique_id=1671817680]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.22, 0)
|
||||
script = ExtResource("2_kpjcp")
|
||||
|
||||
[node name="SpringArm3D" type="SpringArm3D" parent="SpringArmPivot" unique_id=141439848]
|
||||
collision_mask = 2
|
||||
shape = SubResource("SphereShape3D_kne1u")
|
||||
spring_length = 7.0
|
||||
|
||||
[node name="SpringPosition" type="Node3D" parent="SpringArmPivot/SpringArm3D" unique_id=1307131677]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="SpringArmPivot" unique_id=1120161087 node_paths=PackedStringArray("spring_arm")]
|
||||
keep_aspect = 0
|
||||
script = ExtResource("3_kne1u")
|
||||
spring_arm = NodePath("../SpringArm3D/SpringPosition")
|
||||
lerp_power = 6.0
|
||||
|
||||
[node name="bull_v10" parent="." unique_id=1386495166 instance=ExtResource("4_e80uo")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.655, 0.23)
|
||||
@@ -0,0 +1,2 @@
|
||||
hello
|
||||
xd
|
||||
@@ -1,158 +0,0 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
const WALK_SPEED = 6.0
|
||||
const CHARGE_SPEED = 18.0
|
||||
const WALK_ACCEL = 14.0
|
||||
const CHARGE_ACCEL = 40.0
|
||||
const DECELERATION = 12.0
|
||||
const CHARGE_DECEL = 3.5
|
||||
|
||||
const WALK_TURN_FAST = 8.0
|
||||
const WALK_TURN_SLOW = 3.5
|
||||
const CHARGE_TURN = 0.55
|
||||
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
# Hoof positions in bull_v10 local space — tweak y/z if hooves don't line up with the model
|
||||
const HOOF_OFFSETS: Array = [
|
||||
Vector3(-0.30, -0.25, -0.50),
|
||||
Vector3( 0.30, -0.25, -0.50),
|
||||
Vector3(-0.30, -0.25, 0.60),
|
||||
Vector3( 0.30, -0.25, 0.60),
|
||||
]
|
||||
|
||||
@export var visual_turn_speed: float = 12.0
|
||||
|
||||
@onready var camera_pivot: Node3D = $SpringArmPivot
|
||||
@onready var cube_guy: Node3D = $bull_v10
|
||||
|
||||
var current_speed: float = 0.0
|
||||
var facing_angle: float = 0.0
|
||||
|
||||
var _hoof_emitters: Array[CPUParticles3D] = []
|
||||
|
||||
enum _DustState { NONE, WALK, CHARGE }
|
||||
var _dust_state: _DustState = _DustState.NONE
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_setup_hoof_dust()
|
||||
|
||||
|
||||
func _setup_hoof_dust() -> void:
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
|
||||
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||
mat.vertex_color_use_as_albedo = true
|
||||
mat.cull_mode = BaseMaterial3D.CULL_DISABLED
|
||||
|
||||
# 4×2 sphere = chunky low-poly diamond shape
|
||||
var sphere := SphereMesh.new()
|
||||
sphere.radius = 0.10
|
||||
sphere.height = 0.20
|
||||
sphere.radial_segments = 4
|
||||
sphere.rings = 2
|
||||
sphere.material = mat
|
||||
|
||||
# sand colour, fades to transparent over lifetime
|
||||
var ramp := Gradient.new()
|
||||
ramp.set_color(0, Color(0.80, 0.69, 0.46, 1.0))
|
||||
ramp.set_color(1, Color(0.80, 0.69, 0.46, 0.0))
|
||||
|
||||
# puff blooms up then vanishes
|
||||
var scale_curve := Curve.new()
|
||||
scale_curve.add_point(Vector2(0.0, 0.2))
|
||||
scale_curve.add_point(Vector2(0.4, 1.0))
|
||||
scale_curve.add_point(Vector2(1.0, 0.0))
|
||||
|
||||
for offset: Vector3 in HOOF_OFFSETS:
|
||||
var p := CPUParticles3D.new()
|
||||
p.position = offset
|
||||
p.emitting = false
|
||||
p.amount = 12
|
||||
p.lifetime = 0.9
|
||||
p.explosiveness = 0.35
|
||||
p.randomness = 0.6
|
||||
p.local_coords = false
|
||||
p.direction = Vector3(0.0, 1.0, 0.0)
|
||||
p.spread = 45.0
|
||||
p.gravity = Vector3(0.0, -1.5, 0.0)
|
||||
p.initial_velocity_min = 0.8
|
||||
p.initial_velocity_max = 1.8
|
||||
p.scale_amount_min = 0.4
|
||||
p.scale_amount_max = 0.7
|
||||
p.mesh = sphere
|
||||
p.color_ramp = ramp
|
||||
p.scale_amount_curve = scale_curve
|
||||
cube_guy.add_child(p)
|
||||
_hoof_emitters.append(p)
|
||||
|
||||
|
||||
func _set_dust_state(new_state: _DustState) -> void:
|
||||
if new_state == _dust_state:
|
||||
return
|
||||
_dust_state = new_state
|
||||
for p: CPUParticles3D in _hoof_emitters:
|
||||
match new_state:
|
||||
_DustState.NONE:
|
||||
p.emitting = false
|
||||
_DustState.WALK:
|
||||
p.scale_amount_min = 0.35
|
||||
p.scale_amount_max = 0.65
|
||||
p.initial_velocity_min = 0.8
|
||||
p.initial_velocity_max = 1.8
|
||||
p.emitting = true
|
||||
_DustState.CHARGE:
|
||||
p.scale_amount_min = 1.0
|
||||
p.scale_amount_max = 2.2
|
||||
p.initial_velocity_min = 2.8
|
||||
p.initial_velocity_max = 5.5
|
||||
p.emitting = true
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var cam_basis := camera_pivot.global_transform.basis
|
||||
var flat_forward := -Vector3(cam_basis.z.x, 0.0, cam_basis.z.z).normalized()
|
||||
var flat_right := Vector3(cam_basis.x.x, 0.0, cam_basis.x.z).normalized()
|
||||
var direction := (flat_forward * -input_dir.y + flat_right * input_dir.x).normalized()
|
||||
|
||||
if direction:
|
||||
var target_angle := atan2(direction.x, direction.z)
|
||||
|
||||
if current_speed < 0.01:
|
||||
facing_angle = target_angle
|
||||
|
||||
var charging := Input.is_key_pressed(KEY_SHIFT)
|
||||
var speed_t: float = clampf(current_speed / WALK_SPEED, 0.0, 1.0)
|
||||
var turn_rate: float = CHARGE_TURN if charging else lerpf(WALK_TURN_FAST, WALK_TURN_SLOW, speed_t)
|
||||
|
||||
var diff := wrapf(target_angle - facing_angle, -PI, PI)
|
||||
facing_angle += clampf(diff, -turn_rate * delta, turn_rate * delta)
|
||||
|
||||
var top_speed: float = CHARGE_SPEED if charging else WALK_SPEED
|
||||
var accel: float = CHARGE_ACCEL if charging else WALK_ACCEL
|
||||
current_speed = move_toward(current_speed, top_speed, accel * delta)
|
||||
else:
|
||||
var charging := Input.is_key_pressed(KEY_SHIFT)
|
||||
var decel: float = CHARGE_DECEL if charging else DECELERATION
|
||||
current_speed = move_toward(current_speed, 0.0, decel * delta)
|
||||
|
||||
velocity.x = sin(facing_angle) * current_speed
|
||||
velocity.z = cos(facing_angle) * current_speed
|
||||
|
||||
cube_guy.rotation.y = lerp_angle(cube_guy.rotation.y, facing_angle, delta * visual_turn_speed)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
var charging := Input.is_key_pressed(KEY_SHIFT)
|
||||
if current_speed > 0.5 and is_on_floor():
|
||||
_set_dust_state(_DustState.CHARGE if charging else _DustState.WALK)
|
||||
else:
|
||||
_set_dust_state(_DustState.NONE)
|
||||
@@ -1,76 +0,0 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="3rd_person_camera"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
config/run/main_scene="res://scene.tscn"
|
||||
|
||||
[input]
|
||||
|
||||
move_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)
|
||||
, 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":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_back={
|
||||
"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)
|
||||
, 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":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_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)
|
||||
, 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":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_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)
|
||||
, 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":4194321,"key_label":0,"unicode":0,"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)
|
||||
]
|
||||
}
|
||||
zoom_in={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(726, 8),"global_position":Vector2(735, 56),"factor":1.0,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
zoom_out={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(400, 21),"global_position":Vector2(409, 69),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_mouse_capture={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(461, 22),"global_position":Vector2(470, 70),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
charge={
|
||||
"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":4194325,"key_label":0,"unicode":0,"location":1,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
||||
[rendering]
|
||||
|
||||
rendering_device/driver.windows="d3d12"
|
||||
Reference in New Issue
Block a user