Skip to content

Commit

Permalink
customizable push strength
Browse files Browse the repository at this point in the history
  • Loading branch information
krazyjakee committed Nov 20, 2024
1 parent 8693ae5 commit 340f6e5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class_name FirstPersonCharacter extends NodotCharacter3D
@export var minimum_fall_damage: float = 5.0
## The amount of fall damage to inflict when hitting the ground at velocity (0 for disabled)
@export var fall_damage_multiplier: float = 0.5
## The strength that the character will push rigidbodies
@export var push_strength: float = 0.5

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

c.get_collider().apply_central_impulse(-c.get_normal() * 0.25 * c.get_collider().mass)
c.get_collider().apply_central_impulse(-c.get_normal() * push_strength * c.get_collider().mass)

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

0 comments on commit 340f6e5

Please sign in to comment.