Gravity is now toggleable

This commit is contained in:
2024-05-28 20:21:53 -07:00
parent 12cf4d63ab
commit 468ff36f4d

View File

@ -57,6 +57,8 @@ extends CharacterBody3D
@export var view_bobbing : bool = true
@export var jump_animation : bool = true
@export var pausing_enabled : bool = true
@export var gravity_enabled : bool = true
# Member variables
var speed : float = base_speed
@ -139,7 +141,7 @@ func _physics_process(delta):
# Gravity
#gravity = ProjectSettings.get_setting("physics/3d/default_gravity") # If the gravity changes during your game, uncomment this code
if not is_on_floor():
if not is_on_floor() and gravity and gravity_enabled:
velocity.y -= gravity * delta
handle_jumping()