fix: made air accel, velocity dependence tunable
This commit is contained in:
parent
0d052e8f5c
commit
307399349c
@ -14,6 +14,7 @@ var stomp_time := 0.108
|
|||||||
var inair_velocity := 21
|
var inair_velocity := 21
|
||||||
var wallslide_threshold := 1000
|
var wallslide_threshold := 1000
|
||||||
var base_floor_friction := 0.5
|
var base_floor_friction := 0.5
|
||||||
|
var initial_velocity_dependence := 0.7
|
||||||
var floor_friction := base_floor_friction
|
var floor_friction := base_floor_friction
|
||||||
var max_velocity := {
|
var max_velocity := {
|
||||||
"walk": 120, "run": 160, "jump": Vector2(120, 420), "fall": Vector2(120, 420), "walljump": 200, "idle": 12000, "duck": 160
|
"walk": 120, "run": 160, "jump": Vector2(120, 420), "fall": Vector2(120, 420), "walljump": 200, "idle": 12000, "duck": 160
|
||||||
|
|||||||
@ -289,7 +289,9 @@ func calculate_jump_velocity(
|
|||||||
# TODO This is poop too
|
# TODO This is poop too
|
||||||
if -max_velocity["jump"].x < velocity.x and direction.x < 0 || \
|
if -max_velocity["jump"].x < velocity.x and direction.x < 0 || \
|
||||||
max_velocity["jump"].x > velocity.x and direction.x > 0:
|
max_velocity["jump"].x > velocity.x and direction.x > 0:
|
||||||
var movementFactor = (0.3 + abs(velocity.x)/(max_velocity["fall"].x * 1.43 ))
|
var absolut = 1 - initial_velocity_dependence
|
||||||
|
var divisor = 1/max(0.1, initial_velocity_dependence)
|
||||||
|
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
|
||||||
linear_velocity.x = PhysicsFunc.two_step_euler(
|
linear_velocity.x = PhysicsFunc.two_step_euler(
|
||||||
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
|
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
|
||||||
mass,
|
mass,
|
||||||
@ -316,7 +318,9 @@ func calculate_fall_velocity(
|
|||||||
if -max_velocity["fall"].x < velocity.x and direction.x < 0 || \
|
if -max_velocity["fall"].x < velocity.x and direction.x < 0 || \
|
||||||
max_velocity["fall"].x > velocity.x and direction.x > 0:
|
max_velocity["fall"].x > velocity.x and direction.x > 0:
|
||||||
# TODO This is poop
|
# TODO This is poop
|
||||||
var movementFactor = (0.3 + abs(velocity.x)/(max_velocity["fall"].x * 1.43))
|
var absolut = 1 - initial_velocity_dependence
|
||||||
|
var divisor = 1/max(0.1, initial_velocity_dependence)
|
||||||
|
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
|
||||||
linear_velocity.x = PhysicsFunc.two_step_euler(
|
linear_velocity.x = PhysicsFunc.two_step_euler(
|
||||||
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
|
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
|
||||||
mass,
|
mass,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user