mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
Add Flagstand prop and fix walking on non-terrain surfaces
This commit is contained in:
parent
5a3c52c26d
commit
06eeff520d
28
entities/buildings/flag_stand.tscn
Normal file
28
entities/buildings/flag_stand.tscn
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://brux62vritay"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pi2gw"]
|
||||
albedo_color = Color(0.666569, 0.666569, 0.666569, 1)
|
||||
metallic = 0.51
|
||||
roughness = 0.63
|
||||
|
||||
[node name="FlagStand" type="Node3D"]
|
||||
|
||||
[node name="Union" type="CSGCombiner3D" parent="."]
|
||||
material_override = SubResource("StandardMaterial3D_pi2gw")
|
||||
use_collision = true
|
||||
collision_layer = 2147483649
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Union"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
sides = 32
|
||||
|
||||
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Union"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.441611, 0)
|
||||
radius = 2.5
|
||||
height = 1.5
|
||||
sides = 32
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="Union"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.01172, 0)
|
||||
size = Vector3(0.1, 0.025, 0.1)
|
||||
|
|
@ -39,7 +39,7 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
|
|||
@onready var input : PlayerInput = $PlayerInput
|
||||
@onready var camera : Camera3D = $Smoothing/SpringArm3D/Camera3D
|
||||
@onready var hud : CanvasLayer = $HUD
|
||||
@onready var shape_cast : ShapeCast3D = $ShapeCast3D
|
||||
@onready var walkable_surface_sensor : ShapeCast3D = $WalkableSurfaceSensor
|
||||
@onready var weapon : Node3D = $Smoothing/SpringArm3D/Inventory/SpaceGun
|
||||
@onready var animation_player : AnimationPlayer = $AnimationPlayer
|
||||
@onready var health_component : Area3D = $HealthComponent
|
||||
|
|
@ -112,12 +112,7 @@ func _throw_flag() -> void:
|
|||
flag_carry_component.throw(linear_velocity, self)
|
||||
|
||||
func is_on_floor() -> bool:
|
||||
if shape_cast.is_colliding():
|
||||
for i in shape_cast.get_collision_count():
|
||||
var collider : Object = shape_cast.get_collider(i)
|
||||
if collider is Terrain3D:
|
||||
return true
|
||||
return false
|
||||
return walkable_surface_sensor.is_colliding()
|
||||
|
||||
func _is_skiing() -> bool:
|
||||
return input.skiing
|
||||
|
|
@ -185,7 +180,7 @@ func _handle_movement() -> void:
|
|||
if is_on_floor():
|
||||
if not _direction.is_zero_approx() and not _is_skiing():
|
||||
# retrieve collision normal
|
||||
var normal : Vector3 = shape_cast.get_collision_normal(0)
|
||||
var normal : Vector3 = walkable_surface_sensor.get_collision_normal(0)
|
||||
# calculate the angle between the ground normal and the up vector
|
||||
var slope_angle : float = rad_to_deg(acos(normal.dot(Vector3.UP)))
|
||||
# check if the slope angle exceeds the maximum slope angle
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=42 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
[gd_scene load_steps=41 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/player/player.gd" id="1_mk68k"]
|
||||
[ext_resource type="PackedScene" uid="uid://drbefw6akui2v" path="res://entities/player/assets/vanguard.tscn" id="2_beyex"]
|
||||
|
|
@ -21,10 +21,7 @@ resource_local_to_scene = true
|
|||
bounce = 1.0
|
||||
absorbent = true
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1hdqa"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_vmqfq"]
|
||||
material = SubResource("StandardMaterial3D_1hdqa")
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_yvu24"]
|
||||
radius = 0.25
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yqgrk"]
|
||||
|
|
@ -208,19 +205,14 @@ script = ExtResource("1_mk68k")
|
|||
iff = NodePath("Smoothing/ThirdPerson/IFF")
|
||||
jump_height = 1.5
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
visible = false
|
||||
mesh = SubResource("CapsuleMesh_vmqfq")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = ExtResource("2_vjqny")
|
||||
|
||||
[node name="ShapeCast3D" type="ShapeCast3D" parent="."]
|
||||
transform = Transform3D(1.05, 0, 0, 0, 1.05, 0, 0, 0, 1.05, 0, 0, 0)
|
||||
shape = ExtResource("2_vjqny")
|
||||
[node name="WalkableSurfaceSensor" type="ShapeCast3D" parent="."]
|
||||
transform = Transform3D(1.05, 0, 0, 0, 1.05, 0, 0, 0, 1.05, 0, -0.85, 0)
|
||||
shape = SubResource("SphereShape3D_yvu24")
|
||||
target_position = Vector3(0, 0, 0)
|
||||
collision_mask = 2147483648
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="Sensor" type="Area3D" parent="."]
|
||||
collision_layer = 0
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://btlkog4b87p4x"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://btlkog4b87p4x"]
|
||||
|
||||
[ext_resource type="Terrain3DStorage" uid="uid://wgmg245njt8e" path="res://maps/desert/resources/storage.res" id="1_7nbyj"]
|
||||
[ext_resource type="Terrain3DMaterial" uid="uid://c3isipd4wqxpk" path="res://maps/desert/resources/material.tres" id="2_psdr0"]
|
||||
[ext_resource type="Terrain3DTextureList" uid="uid://d1j24k8sq8qpj" path="res://maps/desert/resources/textures.tres" id="3_aowug"]
|
||||
[ext_resource type="Environment" uid="uid://nw62ce5cglvs" path="res://maps/desert/resources/env.tres" id="5_4l4vc"]
|
||||
[ext_resource type="PackedScene" uid="uid://brux62vritay" path="res://entities/buildings/flag_stand.tscn" id="5_5n76t"]
|
||||
|
||||
[node name="Desert" type="Terrain3D"]
|
||||
storage = ExtResource("1_7nbyj")
|
||||
|
|
@ -28,7 +29,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1024, 172.13, 1024)
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1161.42, 174.535, 909.901)
|
||||
|
||||
[node name="FlagStand" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 878.613, 134.55, 916.185)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 895.356, 147.271, 888.261)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 1024, 920, 1024)
|
||||
|
||||
[node name="FlagStand2" parent="." instance=ExtResource("5_5n76t")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 895.366, 145.193, 888.267)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://chbno00ugl6te"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://chbno00ugl6te"]
|
||||
|
||||
[ext_resource type="Terrain3DStorage" uid="uid://dyon4xda4k40d" path="res://maps/genesis/resources/storage.res" id="1_a88qe"]
|
||||
[ext_resource type="Terrain3DMaterial" uid="uid://bd4lr5sxu8xu" path="res://maps/genesis/resources/material.res" id="2_o2y3d"]
|
||||
[ext_resource type="Terrain3DTextureList" uid="uid://dnqa8kxgm3xuw" path="res://maps/genesis/resources/textures.res" id="3_1cww7"]
|
||||
[ext_resource type="Environment" uid="uid://d2ahijqqspw5f" path="res://maps/genesis/resources/env.tres" id="5_3klr3"]
|
||||
[ext_resource type="PackedScene" uid="uid://brux62vritay" path="res://entities/buildings/flag_stand.tscn" id="5_4kwtt"]
|
||||
|
||||
[node name="Genesis" type="Terrain3D"]
|
||||
storage = ExtResource("1_a88qe")
|
||||
|
|
@ -28,19 +29,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 95.5378, -32.735)
|
|||
[node name="Spawn2" type="Marker3D" parent="PlayerSpawns"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9, 98.3078, 18.061)
|
||||
|
||||
[node name="FlagPillar" type="CSGCombiner3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 2.83726, 0, 0, 0, 1, 0, 94.6411, 0)
|
||||
use_collision = true
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="FlagPillar"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9311, 0)
|
||||
size = Vector3(0.5, 6, 0.5)
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="FlagPillar"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.42967, 0)
|
||||
height = 5.0
|
||||
|
||||
[node name="FlagStand" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 108.644, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.847419, 94.7914, -0.106026)
|
||||
|
||||
[node name="FlagPillar" parent="." instance=ExtResource("5_4kwtt")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.849599, 92.7505, -0.104984)
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ scoreboard={
|
|||
|
||||
3d_physics/layer_3="Damage"
|
||||
3d_physics/layer_4="Objective"
|
||||
3d_physics/layer_32="Terrain"
|
||||
3d_physics/layer_32="WalkableSurface"
|
||||
|
||||
[physics]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue