clamber still a bit weird but getting better
This commit is contained in:
@@ -388,9 +388,10 @@ target_position = Vector3(0, -1.995, 0)
|
||||
collision_mask = 33
|
||||
|
||||
[node name="ClamberCheckRay" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.607088, -0.488815)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.607088, -0.279418)
|
||||
target_position = Vector3(0, 0, -1)
|
||||
collision_mask = 33
|
||||
hit_back_faces = false
|
||||
|
||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||
[connection signal="body_entered" from="pick_up_detection" to="." method="_on_pick_up_detection_body_entered"]
|
||||
|
||||
@@ -14,13 +14,18 @@ func standard_movement(delta):
|
||||
character.velocity.x = lerp(character.velocity.x, character.movement_input().x * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||
character.velocity.z = lerp(character.velocity.z, character.movement_input().z * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||
|
||||
func jump_with_weight_mod():
|
||||
character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers()
|
||||
|
||||
func standard_jump():
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
#first check for clamber, otherwise jump
|
||||
print("CAN CLAMBER? - ",character.can_clamber())
|
||||
if character.can_clamber():
|
||||
Transitioned.emit(self,"clamber")
|
||||
else:
|
||||
character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers()
|
||||
if character.jumps_remaining > 0:
|
||||
character.jumps_remaining -= 1
|
||||
jump_with_weight_mod()
|
||||
|
||||
func apply_gravity(delta):
|
||||
character.velocity.y -= 9.8 * 1.25 * delta
|
||||
|
||||
@@ -393,11 +393,15 @@ func speed_modifiers():
|
||||
|
||||
func can_clamber():
|
||||
var clamber_ray_collided = false
|
||||
const CHECK_RESOLUTION = .1
|
||||
const CHECK_RESOLUTION = .01
|
||||
const MAX_RAY_POSITION = .607
|
||||
const MIN_RAY_POSITION = -.9
|
||||
|
||||
clamber_check_ray.position.y = MAX_RAY_POSITION
|
||||
|
||||
while clamber_check_ray.position.y > MIN_RAY_POSITION:
|
||||
print("CLAMBER RAY POS : ", clamber_check_ray.position.y)
|
||||
print("COLLISION : ",clamber_check_ray.is_colliding())
|
||||
if clamber_check_ray.is_colliding():
|
||||
clamber_ray_collided = true
|
||||
break
|
||||
|
||||
@@ -32,7 +32,7 @@ func Physics_Update(delta):
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
if !character.crouch_check.is_colliding():
|
||||
character.recoil.add_recoil(Vector3(-.2,.03,.03),5,10)
|
||||
standard_jump()
|
||||
jump_with_weight_mod()
|
||||
transition_out_of_crouch()
|
||||
|
||||
|
||||
|
||||
@@ -13,14 +13,13 @@ func Physics_Update(delta):
|
||||
standard_movement(delta)
|
||||
apply_gravity(delta)
|
||||
|
||||
standard_jump()
|
||||
|
||||
if character.is_on_floor():
|
||||
Transitioned.emit(self,"on foot")
|
||||
|
||||
enable_wall_rays()
|
||||
|
||||
if Input.is_action_just_pressed("jump") and (character.jumps_remaining > 0 or character.can_clamber()):
|
||||
character.jumps_remaining -= 1
|
||||
standard_jump()
|
||||
|
||||
if Input.is_action_just_pressed("sprint") and air_dash_left > 0:
|
||||
air_dash_left -= 1
|
||||
|
||||
@@ -14,6 +14,4 @@ func Physics_Update(delta):
|
||||
if Input.is_action_just_pressed("crouch"):
|
||||
Transitioned.emit(self,"crouched")
|
||||
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
character.jumps_remaining -= 1
|
||||
standard_jump()
|
||||
|
||||
Reference in New Issue
Block a user