diff --git a/weapons/space_gun/projectile.gd b/weapons/space_gun/projectile.gd index ac28361..96dece8 100644 --- a/weapons/space_gun/projectile.gd +++ b/weapons/space_gun/projectile.gd @@ -1,9 +1,7 @@ extends Node3D -const speed : float = 68.0 +const speed : float = 68.0 # m/s var velocity : Vector3 = Vector3.ZERO - -# @FIXME: with an imaginary box around the map const lifespan : float = 5.0 # in seconds @onready var shape_cast = $ShapeCast3D @@ -30,8 +28,9 @@ func explode(spawn_location): queue_free() func _physics_process(delta): + var previous_position = global_position global_position += velocity * delta - shape_cast.target_position = to_local(global_position - velocity) * delta + shape_cast.target_position = to_local(previous_position) if shape_cast.is_colliding(): var contact_point = shape_cast.collision_result[0].point explode(contact_point) diff --git a/weapons/space_gun/projectile.tscn b/weapons/space_gun/projectile.tscn index 507dc4e..5a115d7 100644 --- a/weapons/space_gun/projectile.tscn +++ b/weapons/space_gun/projectile.tscn @@ -8,14 +8,14 @@ emission_enabled = true emission = Color(0.482353, 0.65098, 1, 1) [sub_resource type="SphereShape3D" id="SphereShape3D_umtte"] -radius = 0.3 +radius = 0.15 [node name="Projectile" type="Node3D"] script = ExtResource("1_4j1dp") [node name="Mesh" type="CSGSphere3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0, 0) -radius = 0.3 +radius = 0.15 radial_segments = 24 rings = 8 material = SubResource("StandardMaterial3D_o6j55")