an error is coming - the identifier 'steer_angle' isn't declared .this error is coming in the line 6

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By saksham061212

extends “res://car base.gd”

func get_input():
var turn = Input.get_action_strength(“steer_left”)
turn -= Input.get_action_strength(“steer_right”)
steer_angle = turn * deg2rad(steering_limit)
$tmpParent/sedanSports/wheel_frontRight.rotation.y = steer_angle2
$tmpParent/sedanSports/wheel_frontLeft.rotation.y = steer_angle
2
acceleration = Vector3.ZERO
if Input.is_action_pressed(“accelerate”):
acceleration = -transform.basis.z * engine_power
if Input.is_action_pressed(“brake”):
acceleration = -transform.basis.z * braking

:bust_in_silhouette: Reply From: jgodfrey

As the error states, steer_angle hasn’t been declared anywhere. If it’s just a temporary, local variable, you need to put var in front of it, like:

var steer_angle = turn * deg2rad(steering_limit)

Otherwise, if it’s more global in nature, you need to define it somewhere (potentially, outside of the above function).