Skip to content

Player Controller

Radik edited this page Aug 19, 2024 · 2 revisions

This project template has a player controller by default and defined in [objects/player/player.gd] with following abilities:

  • Movement
  • Jump
  • Crouch
  • Sprint
  • Noclip
  • Grabbing/Throwing physic items
  • Interaction with items

Movement system

The whole movement system is placed in player.gd and has several exported properties:

Instead of acceleration definition we use a target speed value. This value will be used to calculate acceleration value.

  • max_speed
  • noclip_speed

We also define the height of the jump instead of force from which the force will be calculated.

  • jump_height

Between movement modes (sprint/crouch/noclip) the acceleration multiplied by defined rate. Default walking rate is 1.0 for sprint - 1.5 and for crouch it's 0.5

  • acceleration_rate_change_speed - defines a speed of changing between modes
  • sprint_acceleration_rate
  • crouch_acceleration_rate
  • air_acceleration - default acceleration value when the player in air

Frictions

  • ground_friction
  • air_friction
  • noclip_friction

Crouch properties

  • crouch_height_percent
  • crouch_transition_speed

Misc properties

  • mouse_sensitivity
  • interaction_distance - the maximum distance the player can interact with items

Player processors

The player controller has two processors:

  • Pickup Processor - pickup_processor.gd handles picking up ability
  • Footstep Processor - footstep_processor.gd handles footsteps sounds of the player
Clone this wiki locally