4.3
I built the script for the player model and im working on the passing and shooting
var player_model = $CharacterBody
var move_speed = 10
var teammate
var has_ball
var Vector3 direction = new Vector3
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func passing():
if has_ball:
var target_player = nearest_teammate(direction)
update_render(target_player)
if animation.track_set_key_value(track, last_key, original_position) and Globals.ball != null and weakref(Globals.ball).get_ref():
var a = phys_area.get_global_transform().origin
var b = Globals.ball.get_global_transform().origin
Globals.ball.set_linear_velocity((a-b)*10)
func shooting():
if has_ball:
target.looking_at(Globals.basket)
if animation.track_set_key_value(track, last_key, original_position) and Globals.ball != null and weakref(Globals.ball).get_ref():
var a = phys_area.get_global_transform().origin
var b = Globals.ball.get_global_transform().origin
Globals.ball.set_linear_velocity((a-b)*10)
func traversing():
transform.position += direction * move_speed
transform.looking_at(transform.position * direction)
func nearest_teammate():
var closest_angle = teammate
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
I been using these two unity tutorials to work on the passing and shooting
but i cant shake the error here
var Vector3 direction = new Vector3
Expected end of statement after variable declaration, found “Identifier” instead.