"Object went too far away" error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cobra!
:warning: Old Version Published before Godot 3 was released.

I’m making a 3D space shooter, and I’ve been getting these 3 errors for a while, and I cannot for the life of me figure out what is causing them or how to fix them.

The 3 errors I’m getting are “Object went too far away”, “Method/Function Failed” and “Condition ‘Math:is_nan()’ is true”, and these errors keep popping up in game and is slowing the framerate to a crawl.

I’ve tried making it so that if any object goes a certain distance from the map, it hides and goes back to the begining, but that doesn’t solve it…

This bug occurs at the START of a game, meaning it cannot be the rockets shooting too far, as no rockets would’ve been fired at that point… Also, I have tried adding collision shapes built to detect if an object goes out of bounds, and resets it’s position.

Here’s the code check if any object in the scene is going too far away, called from the main node:

for node in get_children():
	if node extends Spatial:
		if node.get_global_transform().origin.length() >= 10000:
			print(node.get_name())
			node.set_translation(Vector3(0, 0, 0))
			node.hide()

What do I do?

If you are able to see them, here are the images of the errors I’m getting.



it says the object is more than 10 million units from the origin, you should try to use a more reasonable scale

eons | 2016-11-15 00:57

The whole playing field is only about 200 units on all axis, so I don’t think that’s the problem…

Cobra! | 2016-11-15 12:09