Invalid call. nonexistent function in base rigidbody2d

Godot Version

Godot 4.2.1


I am trying to create a simple asteroids clone. I’m using boulders instead of asteroids and in my boulder scene I have created a function called split boulder. Once the bullet (area2d) hits (enters) the boulder(rigidbody2d) it calls the function which then is supposed to create two smaller boulders and erase the original boulder. I seem to be having issues with my new instatiated boulders not having the same functions or variables as the original scene and I don’t understand why. The two new boulders are created, but their scale does not change and then if I shoot them again the game crashes. The error I receive is *invalid call. nonexistent function in base rigidbody2d. I’ve never had an issue with instantiated scenese not having functions in the previous games I made so I’m not sure what I’m doing wrong. I’ve attached an image of my boulder script. the function from my bullet that interacts with the bullet is this.

func _on_body_entered(body):
if body.is_in_group(“boulder”):


how many times


why it spawns itself after the body_entered? and the position of the child is at where the main boulder at? the bullet destroy itself after interacting with main boulder?

Sorry I probably could have formatted my message better. That part of the code is in my bullet (area2d) node and is attached to the on body entered signal. So when the bullet it hits the boulder(rigidbody2d) it calls the function split_boulder() from the boulder and destroys itself. The actual boulder code is in the image that is attached. The print call was for debugging an earlier issue.

the print is actually needed, as to know if the body is called more than once or just once per shot

Once per shot but only on the original boulder that was added in the editor. The new ones cause the game to crash once the bullet enters them. with the error listed in the title.

try change your preload @onready line with

@export var packedBoulder:PackedScene

then assign the boulder scene in the inspector dock of this boulder scene

1 Like

Before you replied I ended up getting rid of the preload and changed my var a and b to load(“res://Scenes/boulder.tscn”).instantiate() so I think you were on the right track. I then created variables for the sprite2d and collision shape and changed the scale of those instead of the rigidbody2d. Everything is now working as I originally intended. Thank you for your help it was driving me crazy. I should have looked at some of the errors in the debugger. They gave me warnings for those two things.

1 Like