Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Napoleonite |
Sorry if this is obvious but I’m very new to this engine. I made a very simple platformer from a tutorial and I constantly get the errors listed below the moment I run the game. I have no idea how to debug this and it does not seem to cause any side-effects. There is no Stack Trace.
I did notice that deleting my Player and Enemy characters from the scene also gets rid of the errors.
0:00:00:0570 - Condition ’ Math::is_nan(p_aabb.size.x) ’ is true.
returned: 0
---------- Type:Error Description: Time: 0:00:00:0570 C Error: Condition ’ Math::is_nan(p_aabb.size.x) ’ is true. returned: 0 C
Source: core\math\octree.h:807 C Function: Octree<struct
VisualServerScene::Instance,1,class DefaultAllocator>::create
When I delete only the player from my starting scene I get this error instead:
0:00:00:0691 - Condition ’ p_aabb.position.y > 1e15 ||
p_aabb.position.y < -1e15 ’ is true. returned: 0
---------- Type:Error Description: Time: 0:00:00:0691 C Error: Condition ’ p_aabb.position.y > 1e15 || p_aabb.position.y < -1e15 ’ is
true. returned: 0 C Source: core\math\octree.h:802 C Function:
Octree<struct VisualServerScene::Instance,1,class
DefaultAllocator>::create
My code:
Character.gd (Player and Enemies inherit from this)
extends KinematicBody2D
var Hitpoints = 1;
const GRAVITY = 20
const UP = Vector2(0, -1)
var Motion = Vector2()
Player code
https://pastebin.com/raw/Bk1gRup5
BaseEnemy.gd
extends "res://Scripts/Character.gd"
var Direction = 1
var MoveSpeed = 20
export var HasCliffDetection = true
export var HasWallDetection = true
onready var RayLeft = get_node("RayLeft")
onready var RayRight = get_node("RayRight")
onready var RayDownLeft = get_node("RayDownLeft")
onready var RayDownRight = get_node("RayDownRight")
func _ready():
pass
func _physics_process(delta):
Move()
if HasCliffDetection and is_on_floor():
CliffDetection()
if HasWallDetection and is_on_floor():
WallDetection()
pass
func Move():
Motion = Vector2(MoveSpeed * Direction,GRAVITY)
Motion = move_and_slide(Motion, UP);
pass
func CliffDetection():
if (Direction == 1) and not RayDownRight.is_colliding():
Flip(-1)
elif (Direction == -1) and not RayDownLeft.is_colliding():
Flip(1)
pass
func WallDetection():
if (Direction == 1) and RayRight.is_colliding():
Flip(-1)
elif (Direction == -1) and RayLeft.is_colliding():
Flip(1)
pass
func Flip(newDirection = 0):
if (newDirection == 0):
Direction *= -1
else:
Direction = newDirection
#$BaseEnemySprite.flip_h = (Direction == -1)
pass
Note that removing Character.gd and deriving directly from KinematicBody2D still produces the same errors.
I don’t have an answer for you but I do have a tip. You don’t need all those ‘pass’ statements except for the one on the func _ready().
All pass does is suppress syntax errors on empty blocks
mrLogan | 2018-05-04 14:42
Ah thanks good tip!
Napoleonite | 2018-05-04 15:40
I’m also having a similar problem in my project, with the difference that in my case it crashes on the common case and if I’m lucky I get the position error and don’t crash. I’ll link the stack trace:
> [Inline Frame] godot.windows.opt.tools.64.exe!List<Octree<pixiel::Construct,0,DefaultAllocator>::PairData *,DefaultAllocator>::push_back(Octree<pixiel::Construct,0,DefaultAllocator>::PairData * const &) Line 229 C++
[Inline Frame] godot.windows.opt.tools.64.exe!List<Octree<pixiel::Construct,0,DefaultAllocator>::PairData *,DefaultAllocator>::operator=(const List<Octree<pixiel::Construct,0,DefaultAllocator>::PairData *,DefaultAllocator> &) Line 448 C++
godot.windows.opt.tools.64.exe!Octree<pixiel::Construct,0,DefaultAllocator>::Element::operator=(const Octree<pixiel::Construct,0,DefaultAllocator>::Element & __that) C++
godot.windows.opt.tools.64.exe!Map<unsigned int,Octree<pixiel::Construct,0,DefaultAllocator>::Element,Comparator<unsigned int>,DefaultAllocator>::_insert(const unsigned int & p_key, const Octree<pixiel::Construct,0,DefaultAllocator>::Element & p_value) Line 355 C++
[Inline Frame] godot.windows.opt.tools.64.exe!Map<unsigned int,Octree<pixiel::Construct,0,DefaultAllocator>::Element,Comparator<unsigned int>,DefaultAllocator>::insert(const unsigned int &) Line 564 C++
godot.windows.opt.tools.64.exe!Octree<pixiel::Construct,0,DefaultAllocator>::create(pixiel::Construct * p_userdata, const AABB & p_aabb, int p_subindex, bool p_pairable, unsigned int p_pairable_type, unsigned int p_pairable_mask) Line 805 C++
Ricard Rovira | 2020-01-06 10:45
removing define REAL_T_IS_DOUBLE solved it for me
Ricard Rovira | 2020-01-06 14:16