Removed GPU particles from Weapon.tscn due to them being broken in Godot at the time

unbroken
unfa 2021-07-01 13:53:05 +02:00
parent 9370af3886
commit 79fd57c344
5 changed files with 103 additions and 71 deletions

View File

@ -109,11 +109,11 @@ func _ready() -> void:
generate_info() generate_info()
rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_PUPPETSYNC) # rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC) # rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET) # rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET)
rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET) # rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET)
head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC) # head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
#rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC) #rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
func aim(event) -> void: func aim(event) -> void:
@ -140,8 +140,9 @@ func _input(event) -> void:
tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT) tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
tween.start() tween.start()
rpc_unreliable(&'aim', event) # rpc_unreliable(&'aim', event)
# rpc(&'aim', event) aim(event)
rpc(&'aim', event)
if Input.is_action_just_pressed("trigger_primary"): if Input.is_action_just_pressed("trigger_primary"):
weapon.rpc(&'trigger', 0, true) weapon.rpc(&'trigger', 0, true)
@ -153,10 +154,10 @@ func _input(event) -> void:
weapon.rpc(&'trigger', 1, false) weapon.rpc(&'trigger', 1, false)
func _physics_process(delta): func _physics_process(delta):
rpc_unreliable(&'set_global_transform', global_transform) # rpc_unreliable(&'set_global_transform', global_transform)
head.rpc_unreliable(&'set_rotation', head.get_rotation()) # head.rpc_unreliable(&'set_rotation', head.get_rotation())
# rpc(&'set_global_transform', global_transform) rpc(&'set_global_transform', global_transform)
# head.rpc(&'set_rotation', head.get_rotation()) head.rpc(&'set_rotation', head.get_rotation())
direction = Vector3.ZERO direction = Vector3.ZERO
@ -193,11 +194,11 @@ func _physics_process(delta):
linear_velocity = velocity + gravity_vec linear_velocity = velocity + gravity_vec
#slide = move_and_slide_with_snap(movement, snap, Vector3.UP) #slide = move_and_slide_with_snap(movement, snap, Vector3.UP)
rpc_unreliable(&'set_linear_velocity', linear_velocity) # rpc_unreliable(&'set_linear_velocity', linear_velocity)
rpc_unreliable(&"move_and_slide") # rpc_unreliable(&"move_and_slide")
# rpc(&'set_linear_velocity', linear_velocity) rpc(&'set_linear_velocity', linear_velocity)
# rpc(&"move_and_slide") rpc(&"move_and_slide")
#move_and_slide() move_and_slide()
if not is_on_floor() and not ground_check.is_colliding(): # while in mid-air collisions affect momentum if not is_on_floor() and not ground_check.is_colliding(): # while in mid-air collisions affect momentum
velocity.x = linear_velocity.x velocity.x = linear_velocity.x

View File

@ -10,7 +10,7 @@ extends Node3D
print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active)) print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active))
if index == 0 and active: if index == 0 and active:
$Flash/Particles.emitting = true $Flash/AnimationPlayer.play("Flash")
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():

View File

@ -1,55 +1,65 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://Assets/Weapons/Handgun/Handgun.gltf" type="PackedScene" id=1] [ext_resource path="res://Assets/Weapons/Handgun/Handgun.gltf" type="PackedScene" id=1]
[ext_resource path="res://Assets/Weapons/Weapon.gd" type="Script" id=2] [ext_resource path="res://Assets/Weapons/Weapon.gd" type="Script" id=2]
[sub_resource type="Gradient" id=1] [sub_resource type="Animation" id=1]
offsets = PackedFloat32Array( 0.00362319, 0.148551, 0.34058, 0.630435, 1 ) resource_name = "Flash"
colors = PackedColorArray( 0, 0, 0, 1, 0.921875, 0.903307, 0.80304, 1, 0.867188, 0.723618, 0.342133, 1, 0.382812, 0.302671, 0.0897217, 1, 0, 0, 0, 1 ) length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(0.420448, 1),
"update": 0,
"values": [Color(4, 2, 0.3, 1), Color(0, 0, 0, 1)]
}
[sub_resource type="GradientTexture" id=2] [sub_resource type="Animation" id=2]
gradient = SubResource( 1 ) resource_name = "Off"
width = 64 length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0, 0, 0, 1)]
}
[sub_resource type="Curve" id=3] [sub_resource type="Animation" id=3]
_data = [ Vector2( 0, 0 ), 0.0, 9.39008, 0, 0, Vector2( 0.0844156, 0.972727 ), 0.649118, 0.649118, 0, 0, Vector2( 1, 0 ), -0.0393939, 0.0, 0, 0 ] length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(4, 2, 0.3, 1)]
}
[sub_resource type="CurveTexture" id=4] [sub_resource type="StandardMaterial3D" id=4]
curve = SubResource( 3 )
[sub_resource type="ParticlesMaterial" id=5]
lifetime_randomness = 0.01
particle_flag_rotate_y = true
direction = Vector3( -1, 0, 0 )
spread = 0.0
gravity = Vector3( 0, 0, 0 )
initial_velocity = 50.0
initial_velocity_random = 0.9
angular_velocity = 1.0
angular_velocity_random = 1.0
damping = 8.0
angle = 360.0
angle_random = 1.0
scale_random = 0.2
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )
anim_offset = 1.0
anim_offset_random = 1.0
attractor_interaction_enabled = false
[sub_resource type="StandardMaterial3D" id=6]
blend_mode = 1 blend_mode = 1
shading_mode = 0 shading_mode = 0
vertex_color_use_as_albedo = true albedo_color = Color(4, 2, 0.3, 1)
albedo_color = Color( 1, 1, 1, 0.196078 ) proximity_fade_distance = 3.94
billboard_mode = 3
particles_anim_h_frames = 2
particles_anim_v_frames = 2
particles_anim_loop = false
[sub_resource type="QuadMesh" id=7] [sub_resource type="SphereMesh" id=5]
material = SubResource( 6 ) material = SubResource( 4 )
size = Vector2( 0.3, 0.3 ) radial_segments = 16
rings = 8
[node name="Weapon" type="Node3D"] [node name="Weapon" type="Node3D"]
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -57,20 +67,23 @@ script = ExtResource( 2 )
[node name="Handgun" parent="." instance=ExtResource( 1 )] [node name="Handgun" parent="." instance=ExtResource( 1 )]
[node name="AnimationPlayer" parent="Handgun" index="4"] [node name="AnimationPlayer" parent="Handgun" index="4"]
blend_times = [ ] blend_times = []
[node name="Flash" type="Node3D" parent="."] [node name="Flash" type="Node3D" parent="."]
script = null script = null
[node name="Particles" type="GPUParticles3D" parent="Flash"] [node name="AnimationPlayer" type="AnimationPlayer" parent="Flash"]
transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.340809, 0.124171, 0 ) autoplay = "Off"
emitting = false anims/Flash = SubResource( 1 )
lifetime = 0.15 anims/Off = SubResource( 2 )
one_shot = true anims/RESET = SubResource( 3 )
explosiveness = 1.0 blend_times = []
fixed_fps = 60 script = null
process_material = SubResource( 5 )
draw_pass_1 = SubResource( 7 ) [node name="MeshInstance3D" type="MeshInstance3D" parent="Flash"]
transform = Transform3D(-0.299894, 0, 0, 0, -0.119659, 0, 0, 0, -0.119659, -0.620616, 0.124179, 0)
mesh = SubResource( 5 )
surface_material_override/0 = null
script = null script = null
[editable path="Handgun"] [editable path="Handgun"]

View File

@ -45,7 +45,7 @@ func _input(_event) -> void:
func create_player(id: int, is_local: bool) -> void: func create_player(id: int, is_local: bool) -> void:
var new_player = player_scene.instance() var new_player = player_scene.instantiate()
var spawnpoint = $Map/SpawnPoints.get_children()[randi() % len($Map/SpawnPoints.get_children())] var spawnpoint = $Map/SpawnPoints.get_children()[randi() % len($Map/SpawnPoints.get_children())]
new_player.name = str(id) new_player.name = str(id)
new_player.global_transform = spawnpoint.global_transform new_player.global_transform = spawnpoint.global_transform

View File

@ -16,7 +16,7 @@ script = ExtResource( 3 )
script = null script = null
[node name="Map" parent="." instance=ExtResource( 1 )] [node name="Map" parent="." instance=ExtResource( 1 )]
transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1 ) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="NetworkTesting" type="VBoxContainer" parent="."] [node name="NetworkTesting" type="VBoxContainer" parent="."]
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -43,5 +43,23 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="TextEdit" type="TextEdit" parent="NetworkTesting"]
offset_top = 66.0
offset_right = 100.0
offset_bottom = 96.0
rect_min_size = Vector2(100, 30)
text = "name"
structured_text_bidi_override_options = []
script = null
[node name="ColorPickerButton" type="ColorPickerButton" parent="NetworkTesting"]
offset_top = 100.0
offset_right = 100.0
offset_bottom = 129.0
script = null
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="NetworkTesting/Host" to="." method="_on_Host_pressed"] [connection signal="pressed" from="NetworkTesting/Host" to="." method="_on_Host_pressed"]
[connection signal="pressed" from="NetworkTesting/Connect" to="." method="_on_Connect_pressed"] [connection signal="pressed" from="NetworkTesting/Connect" to="." method="_on_Connect_pressed"]