A team game with an emphasis on movement (with no shooting), inspired by Overwatch and Zineth
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
881 B

  1. extends "res://player.gd"
  2. const wallride_speed = 2
  3. master func _integrate_forces(state):
  4. ._integrate_forces(state)
  5. wallride(state)
  6. func wallride(state):
  7. var ray = get_node("Ray")
  8. # If our feet aren't touching, but we are colliding, we are wall-riding
  9. if !ray.is_colliding() and get_colliding_bodies():
  10. print("riding")
  11. var aim = get_node("Yaw").get_global_transform().basis
  12. var direction = Vector3()
  13. if Input.is_action_pressed("move_forwards"):
  14. direction -= aim[2]
  15. if Input.is_action_pressed("move_backwards"):
  16. direction += aim[2]
  17. #var n = -1 * (state.get_transform() * state.get_contact_local_normal(0))
  18. #direction = n.slide(direction) * wallride_speed
  19. direction *= 0.1
  20. set_gravity_scale(-0.1)
  21. apply_impulse(Vector3(), direction)
  22. state.integrate_forces()
  23. else:
  24. # We need to return to falling (we aren't riding anymore)
  25. set_gravity_scale(1)