mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 00:44:50 +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
2 changed files with 5 additions and 6 deletions
|
|
@ -1,9 +1,7 @@
|
||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
const speed : float = 68.0
|
const speed : float = 68.0 # m/s
|
||||||
var velocity : Vector3 = Vector3.ZERO
|
var velocity : Vector3 = Vector3.ZERO
|
||||||
|
|
||||||
# @FIXME: with an imaginary box around the map
|
|
||||||
const lifespan : float = 5.0 # in seconds
|
const lifespan : float = 5.0 # in seconds
|
||||||
|
|
||||||
@onready var shape_cast = $ShapeCast3D
|
@onready var shape_cast = $ShapeCast3D
|
||||||
|
|
@ -30,8 +28,9 @@ func explode(spawn_location):
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
var previous_position = global_position
|
||||||
global_position += velocity * delta
|
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():
|
if shape_cast.is_colliding():
|
||||||
var contact_point = shape_cast.collision_result[0].point
|
var contact_point = shape_cast.collision_result[0].point
|
||||||
explode(contact_point)
|
explode(contact_point)
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ emission_enabled = true
|
||||||
emission = Color(0.482353, 0.65098, 1, 1)
|
emission = Color(0.482353, 0.65098, 1, 1)
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_umtte"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_umtte"]
|
||||||
radius = 0.3
|
radius = 0.15
|
||||||
|
|
||||||
[node name="Projectile" type="Node3D"]
|
[node name="Projectile" type="Node3D"]
|
||||||
script = ExtResource("1_4j1dp")
|
script = ExtResource("1_4j1dp")
|
||||||
|
|
||||||
[node name="Mesh" type="CSGSphere3D" parent="."]
|
[node name="Mesh" type="CSGSphere3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0, 0)
|
transform = Transform3D(1, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0, 0)
|
||||||
radius = 0.3
|
radius = 0.15
|
||||||
radial_segments = 24
|
radial_segments = 24
|
||||||
rings = 8
|
rings = 8
|
||||||
material = SubResource("StandardMaterial3D_o6j55")
|
material = SubResource("StandardMaterial3D_o6j55")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue