Cleanup on some stuff I dont use.
This commit is contained in:
parent
6ea1d12ce4
commit
a9afabf0a1
|
|
@ -204,9 +204,7 @@ func new_move_actor_as_desired(_delta :float,
|
||||||
# calc_acceleration.x = 0.0
|
# calc_acceleration.x = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## We are always moving from h_speed.x towards y at a given rate
|
## We are always moving from h_speed.x towards y at a given rate
|
||||||
|
|
||||||
## if we have a difference of speed
|
## if we have a difference of speed
|
||||||
if h_speed.x != h_speed.y:
|
if h_speed.x != h_speed.y:
|
||||||
debug_speed_tracker = h_speed
|
debug_speed_tracker = h_speed
|
||||||
|
|
@ -228,30 +226,9 @@ func new_move_actor_as_desired(_delta :float,
|
||||||
h_speed.y , h_speed.x)
|
h_speed.y , h_speed.x)
|
||||||
var foo = 3
|
var foo = 3
|
||||||
|
|
||||||
## Apply friction
|
|
||||||
#calc_inertia.x = move_toward(calc_inertia.x, 0, (calc_friction.x * _delta))
|
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + (calc_friction.x * _delta),
|
|
||||||
# 0 , h_speed.y)
|
|
||||||
|
|
||||||
|
|
||||||
## Disable this for now hopefully inertial acceleration flip removes this
|
|
||||||
## Update: it mostly did. Going to keep this here for a while though.
|
|
||||||
# The above problem may need a few different scenarios when there is already
|
|
||||||
# applied inertia.
|
|
||||||
# if calc_inertia.x == 0.0:
|
|
||||||
# #calc_inertia.x = lerp( h_speed.x , h_speed.y, calc_acceleration.x * _delta)
|
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + (calc_acceleration.x * _delta),
|
|
||||||
# h_speed.x , h_speed.y)
|
|
||||||
# else:
|
|
||||||
# #calc_inertia.x = lerp( calc_inertia.x, h_speed.y, calc_acceleration.x * _delta)
|
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + ( calc_acceleration.x * _delta),
|
|
||||||
# calc_inertia.x, h_speed.y)
|
|
||||||
elif calc_inertia.x != 0.0: ## We still have inertia but no difference in movement
|
elif calc_inertia.x != 0.0: ## We still have inertia but no difference in movement
|
||||||
if calc_acceleration.x != 0.0: # We are applying acceleration
|
if calc_acceleration.x != 0.0: # We are applying acceleration
|
||||||
## Move back towards the base speed
|
## Move back towards the base speed
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + (calc_acceleration.x * _delta),
|
|
||||||
# h_speed.x , h_speed.y)
|
|
||||||
|
|
||||||
if calc_inertia.x < h_speed.x:
|
if calc_inertia.x < h_speed.x:
|
||||||
calc_inertia.x = clamp( calc_inertia.x + ( calc_acceleration.x * _delta),
|
calc_inertia.x = clamp( calc_inertia.x + ( calc_acceleration.x * _delta),
|
||||||
calc_inertia.x, h_speed.x)
|
calc_inertia.x, h_speed.x)
|
||||||
|
|
@ -265,12 +242,7 @@ func new_move_actor_as_desired(_delta :float,
|
||||||
calc_friction.x = resolve_h_acceleration(movement_params,Vector2(calc_inertia.x, h_speed.x), move_direction.x)
|
calc_friction.x = resolve_h_acceleration(movement_params,Vector2(calc_inertia.x, h_speed.x), move_direction.x)
|
||||||
if calc_friction.x != 0.0: ## No dapening acceleration applies
|
if calc_friction.x != 0.0: ## No dapening acceleration applies
|
||||||
calc_inertia.x = move_toward(calc_inertia.x, h_speed.x, ( calc_friction.x * _delta))
|
calc_inertia.x = move_toward(calc_inertia.x, h_speed.x, ( calc_friction.x * _delta))
|
||||||
# if calc_inertia.x > h_speed.x: ## Inertia is higher than the base speed (slow it down)
|
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + ( calc_friction.x * _delta),
|
|
||||||
# h_speed.x, calc_inertia.x)
|
|
||||||
# else: ## Inertia lower than base speed (we need to catch up)
|
|
||||||
# calc_inertia.x = clamp( calc_inertia.x + ( calc_friction.x * _delta),
|
|
||||||
# calc_inertia.x, h_speed.x)
|
|
||||||
else:
|
else:
|
||||||
## no residual acceleration (friction) applies, kill the momentum
|
## no residual acceleration (friction) applies, kill the momentum
|
||||||
calc_inertia.x = 0.0
|
calc_inertia.x = 0.0
|
||||||
|
|
@ -335,22 +307,7 @@ func resolve_h_speed(_params :Dictionary) -> Vector2:
|
||||||
if _params["_base_h_move_speed_modifier"] != 0:
|
if _params["_base_h_move_speed_modifier"] != 0:
|
||||||
var speed_differance = base_speed + _params["_base_h_move_speed_modifier"]
|
var speed_differance = base_speed + _params["_base_h_move_speed_modifier"]
|
||||||
|
|
||||||
# if sign(_params["_base_h_move_speed_modifier"]) == -1:
|
|
||||||
# return Vector2(speed_differance, base_speed)
|
|
||||||
# else:
|
|
||||||
# return Vector2(base_speed, speed_differance)
|
|
||||||
|
|
||||||
|
|
||||||
return(Vector2(base_speed, speed_differance))
|
return(Vector2(base_speed, speed_differance))
|
||||||
## We start at a slower base speed and move upward
|
|
||||||
## Disabled because flipping accel direction may make more sense.
|
|
||||||
# if speed_differance > base_speed:
|
|
||||||
# return(Vector2(base_speed, speed_differance))
|
|
||||||
# else:
|
|
||||||
# ## We start at a higher speed and move downward to base
|
|
||||||
# return(Vector2(speed_differance, base_speed ))
|
|
||||||
# if inertia:
|
|
||||||
# return Vector2(0,inertia)
|
|
||||||
return Vector2(base_speed,base_speed)
|
return Vector2(base_speed,base_speed)
|
||||||
|
|
||||||
func resolve_h_acceleration(_params :Dictionary, _inertia :Vector2, _move_direction :float) -> float:
|
func resolve_h_acceleration(_params :Dictionary, _inertia :Vector2, _move_direction :float) -> float:
|
||||||
|
|
@ -365,18 +322,12 @@ func resolve_h_acceleration(_params :Dictionary, _inertia :Vector2, _move_direct
|
||||||
if sign(_params["_base_h_move_modifier_move_acceleration"]) == -1 and abs(_inertia.x) >= speed_differance:
|
if sign(_params["_base_h_move_modifier_move_acceleration"]) == -1 and abs(_inertia.x) >= speed_differance:
|
||||||
#print("I should add the modifier acceleration maybe?")
|
#print("I should add the modifier acceleration maybe?")
|
||||||
_acceleration += _params["_base_h_move_modifier_move_acceleration"]
|
_acceleration += _params["_base_h_move_modifier_move_acceleration"]
|
||||||
else:
|
# else:
|
||||||
print ("not yet.")
|
# print ("not yet.")
|
||||||
else:
|
else:
|
||||||
_acceleration = _params["_base_h_move_acceleration"]
|
_acceleration = _params["_base_h_move_acceleration"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#_acceleration *= sign(_move_direction)
|
|
||||||
## Well this didn't work
|
|
||||||
#_acceleration = _params["_base_h_move_acceleration"] + _params["_base_h_move_modifier_move_acceleration"]
|
|
||||||
## If the indented movedirection doesn't match our velocity direction
|
|
||||||
|
|
||||||
if _inertia.x != 0.0 and sign(_inertia.x) != sign(_move_direction):
|
if _inertia.x != 0.0 and sign(_inertia.x) != sign(_move_direction):
|
||||||
return _acceleration * -1
|
return _acceleration * -1
|
||||||
elif sign(_move_direction) != 0:
|
elif sign(_move_direction) != 0:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user