Skip to content

Commit 340f6e5

Browse files
committed
customizable push strength
1 parent 8693ae5 commit 340f6e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

addons/nodot/character/kits/FirstPerson/FirstPersonCharacter.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class_name FirstPersonCharacter extends NodotCharacter3D
1717
@export var minimum_fall_damage: float = 5.0
1818
## The amount of fall damage to inflict when hitting the ground at velocity (0 for disabled)
1919
@export var fall_damage_multiplier: float = 0.5
20+
## The strength that the character will push rigidbodies
21+
@export var push_strength: float = 0.5
2022

2123
## Constructs the step up movement vector.
2224
@onready var step_vector: Vector3 = Vector3(0, step_height, 0)
@@ -171,7 +173,7 @@ func set_rigid_interaction():
171173
elif sign(char_basis.z) == sign(lin_vel.z):
172174
c.get_collider().linear_velocity.z *= -0.1
173175

174-
c.get_collider().apply_central_impulse(-c.get_normal() * 0.25 * c.get_collider().mass)
176+
c.get_collider().apply_central_impulse(-c.get_normal() * push_strength * c.get_collider().mass)
175177

176178
func move_air(delta: float) -> void:
177179
velocity.y = min(terminal_velocity, velocity.y - gravity * delta)

0 commit comments

Comments
 (0)