![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Squabix |
I have created a spacial node called Troll, which has two children: Troll and Sight. Both of them are areas. This is my code for the spacial Troll:
extends Spatial
var velocity = Vector3(0, 0, 0)
var saw = false
var player = null
const SPEED = 2
func _process(delta):
if saw == true:
look_at_from_position(player.position, player, Vector3(0, 1, 0))
velocity.y += SPEED
func _on_Troll_body_entered(body):
player = body
saw = true
func _on_Troll_body_exited(body):
player = null
saw = false
This is the error:
Invalid type in function ‘look_at_from_position; in base "Spatial (MainTroll.gd)’. Cannot convert argument 2 from Objects to Vector3.
“MainTroll.gd” is the script (shown above)
Do you know what’s wrong? Sorry, I’m new to this function.