system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
20xxdd20 |
I’ve been trying to make a gravity similar to this one
I want to replicate so the player can go up on any slopes (even 1 degree slopes) but without the player thrown up in the sky.
system
2
|
|
|
|
Reply From: |
lewis glasgow |
extends KinematicBody
var grav = 0
var vel = Vector3.ZERO
export var grav_strength = 0.4
export var jump_height = 10
func _process(delta):
vel = Vector3.ZERO
if is_on_floor():
grav = 0
vel.y = -grav_strength
else:
grav += grav_strength
if Input.is_action_just_pressed("jump") and is_on_floor():
vel.y = 0
grav = -jump_height
print(grav)
vel.y -= grav
move_and_slide(vel,Vector3.UP)