mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 08:55:33 +00:00
Merge branch 'fix/flag-not-jumping-on-explosion' into 'develop'
Fix explosion impulses to apply against the rigidbody's center of mass See merge request open-fpsz/open-fpsz!51
This commit is contained in:
commit
d6d2bf7866
2 changed files with 4 additions and 1 deletions
|
|
@ -20,7 +20,8 @@ class_name ExplosiveDamageComponent extends Area3D
|
||||||
func _physics_process(_delta : float) -> void:
|
func _physics_process(_delta : float) -> void:
|
||||||
for body in get_overlapping_bodies():
|
for body in get_overlapping_bodies():
|
||||||
if body is RigidBody3D:
|
if body is RigidBody3D:
|
||||||
var direction : Vector3 = (body.global_position - global_position).normalized()
|
var center_of_mass_global_position : Vector3 = body.center_of_mass + body.global_position
|
||||||
|
var direction : Vector3 = ( center_of_mass_global_position - global_position).normalized()
|
||||||
body.apply_central_impulse(direction * impulse_force)
|
body.apply_central_impulse(direction * impulse_force)
|
||||||
|
|
||||||
for area in get_overlapping_areas():
|
for area in get_overlapping_areas():
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ axis_lock_angular_y = true
|
||||||
axis_lock_angular_z = true
|
axis_lock_angular_z = true
|
||||||
mass = 40.0
|
mass = 40.0
|
||||||
physics_material_override = SubResource("PhysicsMaterial_4ymrw")
|
physics_material_override = SubResource("PhysicsMaterial_4ymrw")
|
||||||
|
center_of_mass_mode = 1
|
||||||
|
center_of_mass = Vector3(0, 0.5, 0)
|
||||||
continuous_cd = true
|
continuous_cd = true
|
||||||
script = ExtResource("1_y7d3d")
|
script = ExtResource("1_y7d3d")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue