
SuperStrict

Import newton.dynamics
Import openb3d.b3dglgraphics

' Set autofail to False to manually handle Null return...

Function CreateNewtonWorld:TNWorld (autofail:Int = True)
	
	Local world:TNWorld = TNWorld.Create ()
	
	If autofail And world = Null
		RuntimeError "CreateNewtonWorld: failed to create Newton world!"
		End
	EndIf
	
	Return world
	
End Function

Function UpdateNewtonWorld (world:TNWorld, update_rate:Float)
	world.Update 1.0/update_rate
End Function

Function ResetNewtonWorld (world:TNWorld)
	world.InvalidateCache
End Function
