mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
Merge branch 'fix/projectile-size-and-collisions' into 'develop'
🐛 Fix projectile size and collisions See merge request open-fpsz/open-fpsz!19
This commit is contained in:
commit
2d8bb1a713
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue