
Click Here to Dowload Godot






















Adjust line 14 and 19 to our needs (Inside func _input())
# Handle jump.
if Input.is_action_just_pressed("player_jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("player_left", "player_right", "player_forward", "player_back")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
The function call will be called by the game engine on ready
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# Top of the Script
extends CharacterBody3D
const SPEED = 5.0
const JUMP_VELOCITY = 4.5
const MOUSE_SENSETIVITY = 0.1 #ADDED CODE
...
...
...
func _process(delta: float) -> void:
if Input.is_action_just_pressed("pause"):
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
Input.mouse_mode =Input.MOUSE_MODE_VISIBLE
else:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(event: InputEvent) -> void:
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
if event is InputEventMouseMotion:
rotation_degrees.x -= event.relative.y * MOUSE_SENSETIVITY
rotation_degrees.y -= event.relative.x * MOUSE_SENSETIVITY
rotation_degrees.x = clamp(rotation_degrees.x, -90.0, 90.0)
You may notice that it feels bad and not fun to use. The reason for this is because there is not inertia in the controller right, main cause of this, is that the default Godot CharacterBody3D is a little scuffed.
var input_dir := Input.get_vector("player_left", "player_right", "player_forward", "player_back")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
# START OF NEW CODE
if is_on_floor(): # ADDED IF STATEMENT FOR AIR CONTROLS
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
# CHANGED CODE HERE FOR ACTUAL WORKING SLOWING (because godot template was scuffed) (ADDED CODE)
velocity.x = lerp(velocity.x, direction.x * SPEED, delta * 4.0)
velocity.z = lerp(velocity.z, direction.z * SPEED, delta * 4.0)
# ADDED CODE
else:
velocity.x = lerp(velocity.x, direction.x * SPEED, delta * 3.0)
velocity.z = lerp(velocity.z, direction.z * SPEED, delta * 3.0)
# END OF NEW CODE STUFF
move_and_slide()
From: Input.is_action_just_pressed("player_jump")
To: Input.is_action_pressed("player_jump")
# Handle jump.
if Input.is_action_pressed("player_jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
✅ Now you have a very basic Godot Player Controller
✅ Next workshop we will make a primitive First Person Shooter using this controller
✅ Please make sure to check-in

Thanks for participating in this codelab!
And to our newcomers this seal is Solly. He is our current unofficial club mascot.
His lore is that he works for a AAA game company. As such, by logical implicit stance (A.K.A Modus Ponens)
p -> q, p ∴ q
let p = AAA company S̶l̶a̶v̶e employee
let q = Depression and basement dweller
To help Solly cope from this depression we require funding from USF and the only way we can request for funding is by proving we are an impactful club.
One proof of being an impactful club is club attendance/participation, so please don't forget to check in on BullsConnect.