fix first bullet

This commit is contained in:
leca 2024-03-27 20:47:54 +03:00
parent 52400f950a
commit b3040b4de0
3 changed files with 5 additions and 2 deletions

View File

@ -57,7 +57,7 @@ mesh = ExtResource("2_7hcoq")
surface_material_override/0 = SubResource("StandardMaterial3D_0suq1")
[node name="raycast" type="RayCast3D" parent="Head/Camera/Hand/knife"]
transform = Transform3D(1, -2.38419e-07, -1.49012e-08, -5.96046e-08, 1, 0, 0, -1.11759e-08, 1, -0.04988, 2.15182, 0.0228496)
transform = Transform3D(-0.499475, -0.84915, -0.171667, 0.861274, -0.508089, 0.00733016, -0.0934463, -0.144191, 0.985128, -0.04988, 2.15182, 0.02285)
[node name="pistol" parent="Head/Camera/Hand" instance=ExtResource("2_nxbij")]
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 2.38419e-07, -0.0344509, 0.118615)

View File

@ -132,6 +132,8 @@ func shot(client_id):
var target_point = raycast.get_collision_point()
weapon_raycast.target_position = weapon_raycast.to_local(target_point) * 1.1
weapon_raycast.force_raycast_update()
weapon_raycast.force_update_transform()
weapon_raycast.rotation.y = atan((weapon_raycast.position.x - client_playermodel.position.x) / ((-current_weapon_settings["range"]) - (abs(weapon_raycast.position.z - client_playermodel.position.z))))
weapon_raycast.target_position.y += current_weapon_settings["spreading"] * randf() * sin(randf() * 2 * PI)

View File

@ -208,8 +208,9 @@ func try_shoot():
var target_point = raycast.get_collision_point()
weapon_raycast.target_position = weapon_raycast.to_local(target_point) * 1.1
weapon_raycast.force_raycast_update()
weapon_raycast.force_update_transform()
weapon_raycast.rotation.y = atan((weapon_raycast.position.x - position.x) / ((-current_weapon_settings["range"]) - (abs(weapon_raycast.position.z - position.z))))
weapon_raycast.target_position.y += current_weapon_settings["spreading"] * randf() * sin(randf() * 2 * PI)
weapon_raycast.target_position.z += current_weapon_settings["spreading"] * randf() * cos(randf() * 2 * PI)