0 votes

extends Spatial

func _ready():

if get_node('KinematicBody').Vector3(10, 0, 0):
    var terrain = load('res://Terrain_grass.tscn')
    terrain.duplicate()
    printraw('Mesh duplicated')
    var terrain_position = Vector3()
    pass

the error "Attempt to call function 'vector3' in base 'null instance' on null instance" pops up.
sorry but I'm new here, so any help will be very much appreciated!

in Engine by (15 points)

1 Answer

0 votes

Based on your input, I can say that get_node does not find KinematicBody. Thus it returns null. And then youre trying to call Vector3 on null. So first check if kinematic body really is a child of the spatial node where you bound this script. Second thing; what is the first line trying to achieve? 3. You dont need the pass at the end. Pass is literaly „do nothing“ clause just bloating your code.

by (709 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.