I am following a tutorial and am brand new to the engine, coding, and game designing in general. Regardless, I do not understand why this error is popping up for me as no one else has commented a problem like mine. Something has to have changed as my code looks exactly as the tutorials.

``````extends KinematicBody

export var gravity = -20.0
export var wheel_base = 0.6
export var steering_limit = 10.0
export var engine_power = 6.0
export var braking = -9.0
export var friction = -2.0
export var drag = -2.0
export var max_speed_reverse = 3.0

var acceleration = Vector3.ZERO
var velocity = Vector3.ZERO
var steer_angle = 0.0

func _physics_process(delta):
if is_on_floor():
get_input()
apply_friction(delta)                 #This is the problem child.
calculate_steering(delta)
acceleration.y = gravity
velocity += acceleration * delta
velocity = move_and_slide_with_snap(velocity, -transform.basis.y, Vector3.UP, true)

func apply_fcrition(delta):
if velocity.length() < 0.2 and acceleration.length() == 0:
velocity.x = 0
velocity.z = 0
var friction_force = velocity * friction * delta
var drag_froce = velocity * velocity.length() * delta
acceleration += drag_force + friction_force                         #This is giving me problems as well.
``````

I have no idea why its being changed. But it looks like this. "apply_friction(delta)"

Godot version 3.3.2
in Engine
edited

I edited your post to fix the formatting. Please use the "code sample" button when posting code.

+1 vote

It's saying `apply_friction()` isn't defined, because you defined this:

``````func apply_fcrition(delta):
``````
by (20,479 points)

Wow, can't believe I missed that. Took me a minute to see where that was.

Can anyone help with the second problem?

"The identifier "drag_force" isn't declared in the current scope."

Same thing. You wrote `drag_froce` on the line before.

This is quite embarrassing.

"Can't get index "basic" on base "transform".

``````func calculate_steering(delta):
var rear_wheel = transform.origin + transform.basic.z * wheel_base / 2.0
var front_wheel = transform.origin - transform.basic.z * wheel_base / 2.0
rear_wheel += velocity * delta
front_wheel += velocity.rotated(transform.basic.y, steer_angle) * delta
It's `basis`, not `basic`.