Neko box2d B2Settings error


openfl test neko

throwing following error:

Called from [box2D/common/B2Settings.hx,72]
Called from 2372777
Uncaught exception - Invalid operation (*)

while app is working as flash and html5, while on line 72 of B2Settings.hx is:

static public var b2_polygonRadius:Float = 2.0 * b2_linearSlop;

I find nothing wrong, here. I kept it (2.0 * b2_linearSlop) in parenthesis and still causing same error.

From the error it must mean that b2_linearSlop is null,
you need to initialize it before using it since on neko it defaults to null instead of 0.


I am not using b2_linearSlop in my app code

But B2Settings.hx reside in haxe box2d liberary. here is the path

I just moved the code of initialization b2_linearSlope above line 72, then this error went away but throwing more similar errors for e.g.

Invalid operation (&)
Called from box2D/dynamics/B2World.hx line 959
Called from box2D/dynamics/B2World.hx line 176
Called from box2D/dynamics/B2World.hx line 91
Called from a C function
Called from box2D/dynamics/B2World.hx line 52
Called from Game.hx line 32
Called from a C function
Called from Game.hx line 19
Called from Main.hx line 35
Called from Main.hx line 64
Called from openfl/_v2/events/EventDispatcher.hx line 270
Called from openfl/_v2/events/EventDispatcher.hx line 100
Called from a C function
Called from openfl/_v2/display/DisplayObject.hx line 72
Called from openfl/_v2/display/DisplayObject.hx line 375
Called from a C function
Called from openfl/_v2/display/DisplayObjectContainer.hx line 373
Called from openfl/_v2/display/DisplayObject.hx line 436
Called from openfl/_v2/display/DisplayObjectContainer.hx line 31
Called from Main.hx line 73
Called from a C function
Called from ApplicationMain.hx line 98
Called from openfl/_v2/Lib.hx line 114

I tried to resolve errors myself and stuck on a createFixture error which need more deeper knowledge of box2d liberary.

I see you have an old version of box2d, could you do a haxelib update box2d?
You can check that you have the latest one, 1.2.3, with haxelib list, the selected version is between brackets, so it should look similar to this: box2d: 1.2.0 [1.2.3].
If it’s not the right one selected do a haxelib set box2d 1.2.3.

I fixed a batch of Neko-related bugs in Box2D, but if you find others, happy to include fixes for them :slight_smile: