Newton Module (2-22-7)

BlitzMax Forums/BlitzMax Programming/Newton Module (2-22-7)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This adds syntax highlighting and a couple of extra functions.

I am not going to document this, but if someone else wants to, I will use whatever they give me. Newton comes with a chm file you could cut and paste from.
Strict

Rem
bbdoc: www.newtongamedynamics.com
End Rem
Module Pub.Newton

Import Pub.Win32

Extern
	Function FreeLibrary(hlib:Int)="FreeLibrary@4"
EndExtern

'================================================
' World Functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionGetVertexListIndexListInAABB:Int(collision:Byte Ptr,p0:Byte Ptr,p1:Byte Ptr,vertexarray:Byte Ptr,vertexcount:Byte Ptr,vertexstride:Byte Ptr,indicelist:Byte Ptr,indicelistsize:Int)

Rem
bbdoc: la la la
End Rem
Global NewtonWorldForEachBodyInAABBDo(world:Byte Ptr,p0:Byte Ptr,p1:Byte Ptr,callback:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonCollisionMakeUnique( nworld:Byte Ptr,collisionPtr:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonCreate:Byte Ptr( mallocFnt: Byte Ptr, mfreeFnt:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonDestroy(nWorld: Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUpdate(newtonWorld: Byte Ptr, time:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonDestroyAllBodies(newtonWorld: Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSetSolverModel(newtonWorld:Byte Ptr, model:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonSetFrictionModel(newtonWorld:Byte Ptr, model:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonGetTimeStep:Float(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSetMinimumFrameRate(newtonWorld:Byte Ptr, frameRate:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonSetBodyLeaveWorldEvent(newtonWorld:Byte Ptr, BodyLeaveWorld_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSetWorldSize(newtonWorld: Byte Ptr, minPoint: Byte Ptr, maxPoint:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldFreezeBody(newtonWorld:Byte Ptr, body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldUnfreezeBody(newtonWorld: Byte Ptr, body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldForEachBodyDo(newtonWorld:Byte Ptr, BodyIterator_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldSetUserData(newtonWorld:Byte Ptr, userData:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldGetUserData:Byte Ptr(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldGetVersion:Int(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldRayCast(newtonWorld:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr, WorldRayFilterCallback:Byte Ptr, userData:Byte Ptr,WorldRayPrefilterCallback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonWorldCollide:Int(newtonWorld:Byte Ptr, maxSize:Int,collsionA:Byte Ptr, matrixA:Byte Ptr, collsionB:Byte Ptr, matrixB:Byte Ptr, contacts:Byte Ptr, normals:Byte Ptr, penetration:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetDefaultGroupID:Int(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialCreateGroupID:Int(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialDestroyAllGroupID(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetDefaultSoftness(newtonWorld:Byte Ptr, id0:Int, id1:Int, value:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetDefaultElasticity(newtonWorld:Byte Ptr, id0:Int, id1:Int, elasticCoef:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetDefaultCollidable(newtonWorld:Byte Ptr, id0:Int, id1:Int, state:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetDefaultFriction(newtonWorld:Byte Ptr, id0:Int, id1:Int, staticFriction:Float, kineticFriction:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetCollisionCallback(newtonWorld:Byte Ptr, id0:Int, id1:Int, userData:Byte Ptr, begin:Byte Ptr, process:Byte Ptr, NEnd:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetUserData:Byte Ptr(newtonWorld:Byte Ptr, id0:Int, id1:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialDisableContact (material:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetCurrentTimestep:Float(material:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetMaterialPairUserData:Byte Ptr(material:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactFaceAttribute:Int(material: Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetBodyCollisionID:Int(material: Byte Ptr, body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactNormalSpeed:Float(material:Byte Ptr, contactlHandle:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactForce(material: Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactPositionAndNormal(material:Byte Ptr, posit:Byte Ptr, normal:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactTangentDirections(material:Byte Ptr, dir0:Byte Ptr, dir:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialGetContactTangentSpeed:Float(material:Byte Ptr, NewtonContact:Byte Ptr, index:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetCentreOfMass(body:Byte Ptr,pos:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactNormalAcceleration(material:Byte Ptr,vec:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonSetPlatformArchitecture(world:Byte Ptr,mode:Int)

Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactSoftness(NewtonMaterial:Byte Ptr, softness:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactElasticity(NewtonMaterial:Byte Ptr, restitution:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactFrictionState(NewtonMaterial:Byte Ptr, state:Int, index:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactStaticFrictionCoef(NewtonMaterial:Byte Ptr, coef:Float, index:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactKineticFrictionCoef(NewtonMaterial:Byte Ptr, coef:Float, index:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonMaterialSetContactTangentAcceleration(NewtonMaterial:Byte Ptr, accel:Float, index:Int)
Rem
bbdoc: la la la
End Rem

Global NewtonMaterialSetContactNormalDirection(NewtonMaterial:Byte Ptr,normal:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonMaterialContactRotateTangentDirections(NewtonMaterial:Byte Ptr, directionVector:Byte Ptr)

'================================================
' convex collision primitives creation functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonCreateNull:Byte Ptr(newtonWorld:Byte Ptr)	'NewtonCollision
Rem
bbdoc: la la la
End Rem
Global NewtonCreateSphere:Byte Ptr(newtonWorld:Byte Ptr, radiusX:Float, radiusY:Float, radiusZ:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateBox:Byte Ptr(newtonWorld:Byte Ptr, dx:Float, dy:Float, dz:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateCone:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateCapsule:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateCylinder:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateChamferCylinder:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateConvexHull:Byte Ptr(newtonWorld:Byte Ptr, count:Int, vertexCloud:Byte Ptr, strideInBytes:Int, offsetMatrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateConvexHullModifier:Byte Ptr(newtonWorld:Byte Ptr, convexHullCollision:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonConvexHullModifierGetMatrix(convexHullCollision:Byte Ptr, matrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonConvexHullModifierSetMatrix(convexHullCollision:Byte Ptr, matrix:Byte Ptr)
	
Rem
bbdoc: la la la
End Rem
Global NewtonConvexCollisionSetUserID(convexCollision:Byte Ptr, id:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonConvexCollisionGetUserID:Int(convexCollision:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonConvexCollisionCalculateInertialMatrix(collision:Byte Ptr,inertia:Byte Ptr,center:Byte Ptr)

'================================================
'complex collision primitives creation functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonCreateCompoundCollision:Byte Ptr(newtonWorld:Byte Ptr, count:Int, collisionPrimitiveArray:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateUserMeshCollision:Byte Ptr(newtonWorld:Byte Ptr, minBox:Byte Ptr, maxBox:Byte Ptr, userData:Byte Ptr, collideCallback:Byte Ptr, rayHitCallback:Byte Ptr, destroyCallback:Byte Ptr)

'================================================
' CollisionTree Utility functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonCreateTreeCollision:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionBeginBuild(NewtonCollision: Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionAddFace(NewtonCollision: Byte Ptr, vertexCount:Int, vertexPtr: Byte Ptr, strideInBytes:Int, faceAttribute:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionEndBuild(NewtonCollision: Byte Ptr, optimize:Int)
'	NEWTON_API void NewtonTreeCollisionSerialize (Const NewtonCollision* treeCollision, NewtonSerialize serializeFunction, 
'		void* serializeHandle);
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionSerialize(treeCollision:Byte Ptr,serializeFunction:Byte Ptr,serializeHandle:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCreateTreeCollisionFromSerialization:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr,deserializeFunction:Byte Ptr, serializeHandle:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionGetFaceAtribute:Int(NewtonCollision:Byte Ptr, faceIndexArray:Byte Ptr) 
Rem
bbdoc: la la la
End Rem
Global NewtonTreeCollisionSetFaceAtribute(NewtonCollision: Byte Ptr, faceIndexArray: Byte Ptr, attribute:Int) 

'================================================
' Collision Miscelaneos Function
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonReleaseCollision(newtonWorld:Byte Ptr, NewtonCollision:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCollisionCalculateAABB(NewtonCollision:Byte Ptr, matrix:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCollisionRayCast:Float(NewtonCollision:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr, normals:Byte Ptr, attribute:Byte Ptr)

'================================================
' transforms utility functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonGetEulerAngle(matrix:Byte Ptr, eulersAngles:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSetEulerAngle(eulersAngles:Byte Ptr, matrix:Byte Ptr)


Rem
bbdoc: la la la
End Rem
Global NewtonCollisionCollide:Int(world:Byte Ptr,maxSize:Int,collision0:Byte Ptr,matrix0:Byte Ptr,collision1:Byte Ptr,matrix1:Byte Ptr,contacts:Byte Ptr,normals:Byte Ptr,penetration:Byte Ptr)

'================================================
' body manipulation functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonCreateBody:Byte Ptr(newtonWorld:Byte Ptr, NewtonCollision:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonDestroyBody(newtonWorld:Byte Ptr, body:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonBodyAddForce(body:Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyAddTorque(body:Byte Ptr, torque:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonBodySetMatrix(body:Byte Ptr, matrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetMatrixRecursive(body:Byte Ptr, matrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetMassMatrix(body:Byte Ptr, mass:Float, Ixx:Float, Iyy:Float, Izz:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetMaterialGroupID(body:Byte Ptr, id:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetContinuousCollisionMode(body:Byte Ptr, state:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetJointRecursiveCollision(body:Byte Ptr, state:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetOmega(body:Byte Ptr, omega:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetVelocity(body:Byte Ptr, velocity:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetForce (body:Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetTorque(body:Byte Ptr, torque:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetLinearDamping(body:Byte Ptr, linearDamp:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetAngularDamping(body:Byte Ptr, angularDamp:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetUserData(body:Byte Ptr, userData:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyCoriolisForcesMode(body:Byte Ptr, mode:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetCollision(body:Byte Ptr, collision:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetAutoFreeze(body:Byte Ptr, state:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetFreezeTreshold(body:Byte Ptr, freezeSpeed2:Float, freezeOmega2:Float, framesCount:Int)
	
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetTransformCallback(body:Byte Ptr, SetTransform_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetDestructorCallback(body:Byte Ptr, BodyDest_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetAutoactiveCallback(body:Byte Ptr, BodyActState_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodySetForceAndTorqueCallback(body:Byte Ptr, ApplyForceTorque_callback:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetWorld:Byte Ptr(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetUserData:Byte Ptr(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetCollision:Byte Ptr(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetMaterialGroupID:Int(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetContinuousCollisionMode:Int(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetJointRecursiveCollision:Int(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetMatrix(body:Byte Ptr, matrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetMassMatrix(body:Byte Ptr, mass:Byte Ptr, Ixx:Byte Ptr, Iyy:Byte Ptr, Izz:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetInvMass(body:Byte Ptr, invMass:Byte Ptr, invIxx:Byte Ptr, invIyy:Byte Ptr, invIzz:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetOmega(body:Byte Ptr, vector:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetVelocity(body:Byte Ptr, vector:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetForce(body:Byte Ptr, vector:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetTorque(body:Byte Ptr, vector:Byte Ptr)
	
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetSleepingState:Int(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetAutoFreeze:Int(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetLinearDamping:Float(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetAngularDamping (body:Byte Ptr, vector:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetAABB (body:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr)	
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetFreezeTreshold(body:Byte Ptr, freezeSpeed2:Byte Ptr, freezeOmega2:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyGetTotalVolume:Float(body:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBodyAddBuoyancyForce(body:Byte Ptr, fluidDensity:Float, fluidLinearViscosity:Float, fluidAngularViscosity:Float,gravityVector:Byte Ptr, buoyancyPlane:Byte Ptr, context:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonBodyForEachPolygonDo (body:Byte Ptr, CollisionIterator_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonAddBodyImpulse(body:Byte Ptr, pointDeltaVeloc:Byte Ptr, pointPosit:Byte Ptr)

'================================================
' Common joint funtions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonJointGetUserData:Byte Ptr(joint:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonJointSetUserData(joint:Byte Ptr, userData:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonJointGetCollisionState:Int(joint:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonJointSetCollisionState(joint:Byte Ptr, state:Int)

Rem
bbdoc: la la la
End Rem
Global NewtonJointGetStiffness:Float(joint:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonJointSetStiffness(joint:Byte Ptr, state:Float)

Rem
bbdoc: la la la
End Rem
Global NewtonDestroyJoint(newtonWorld:Byte Ptr, joint:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonJointSetDestructor(joint:Byte Ptr, destructor:Byte Ptr)

'================================================
' Ball And Socket joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateBall:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBallSetUserCallback(ball:Byte Ptr, BallCallBack_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBallGetJointAngle (ball:Byte Ptr, angle:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBallGetJointOmega (ball:Byte Ptr, omega:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBallGetJointForce (ball:Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonBallSetConeLimits (ball:Byte Ptr, pin:Byte Ptr, maxConeAngle:Float, maxTwistAngle:Float)

'================================================
' Hinge joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateHinge:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonHingeSetUserCallback(hinge:Byte Ptr, HingeCallBack_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonHingeGetJointAngle:Float(hinge:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonHingeGetJointOmega:Float(hinge:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonHingeGetJointForce(hinge:Byte Ptr,  force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonHingeCalculateStopAlpha:Float(hinge:Byte Ptr, desc:Byte Ptr, angle:Float)


'================================================
' Slider joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateSlider:Byte Ptr(newtonWorld:Byte Ptr,pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSliderSetUserCallback(slider:Byte Ptr, SliderCallBack_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSliderGetJointPosit:Float(slider:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSliderGetJointVeloc:Float(slider:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSliderGetJointForce (slider:Byte Ptr,  force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonSliderCalculateStopAccel:Float(slider:Byte Ptr, desc:Byte Ptr, position:Float)


'================================================
' Corkscrew joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateCorkscrew:Byte Ptr(newtonWorld:Byte Ptr,pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewSetUserCallback(corkscrew:Byte Ptr, CorkscrewCallBack_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewGetJointPosit:Float (corkscrew:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewGetJointAngle:Float( corkscrew:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewGetJointVeloc:Float(corkscrew:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewGetJointOmega:Float( corkscrew:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewGetJointForce(corkscrew:Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewCalculateStopAlpha:Float(corkscrew:Byte Ptr, desc:Byte Ptr, angle:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonCorkscrewCalculateStopAccel:Float(corkscrew:Byte Ptr, desc:Byte Ptr, position:Float)


'================================================
' Universal joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateUniversal:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, pinDir0:Byte Ptr, pinDir1:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalSetUserCallback(universal:Byte Ptr, UniversalCallBack_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalGetJointAngle0:Float( universal:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalGetJointAngle1:Float(universal:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalGetJointOmega0:Float( universal:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalGetJointOmega1:Float (universal:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalGetJointForce(universal:Byte Ptr, force:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalCalculateStopAlpha0:Float(universal:Byte Ptr, desc:Byte Ptr, angle:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonUniversalCalculateStopAlpha1:Float(universal:Byte Ptr, desc:Byte Ptr, angle:Float)


'================================================
'Up vector joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateUpVector:Byte Ptr(newtonWorld:Byte Ptr, pinDir:Byte Ptr, body:Byte Ptr) 
Rem
bbdoc: la la la
End Rem
Global NewtonUpVectorGetPin(upVector:Byte Ptr, pin:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUpVectorSetPin(upVector:Byte Ptr, pin:Byte Ptr)


'================================================
' User defined bilateral Joint
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateUserJoint:Byte Ptr(newtonWorld:Byte Ptr, maxDOF:Int, UserBilateralCallBack_callback:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr) 
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointAddLinearRow(joint:Byte Ptr, pivot0:Byte Ptr, pivot1:Byte Ptr, dir:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointAddAngularRow(joint:Byte Ptr, relativeAngle:Float, dir:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointSetRowMinimunFriction(joint:Byte Ptr,  friction:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointSetRowMaximunFriction( joint:Float, friction:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointSetRowAcceleration(joint:Byte Ptr,  acceleration:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointSetRowStiffness( joint:Float,stiffness:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonUserJointGetRowForce:Float(joint:Byte Ptr, row:Int)


'================================================
' Ragdoll joint contatiner funtion
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonCreateRagDoll:Byte Ptr(newtonWorld:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonDestroyRagDoll(newtonWorld:Byte Ptr, ragDoll:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBegin( ragDoll:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollEnd( ragDoll:Byte Ptr)


Rem
bbdoc: la la la
End Rem
Global NewtonRagDollFindBone:Byte Ptr( ragDoll:Byte Ptr, id:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollGetRootBone:Byte Ptr( ragDoll:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonRagDollSetForceAndTorqueCallback( ragDoll:Byte Ptr, ApplyForceAndTorque_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollSetTransformCallback(ragDoll:Byte Ptr, SetRagDollTransform_callback:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollAddBone:Byte Ptr(ragDoll:Byte Ptr, parent:Byte Ptr, userData:Byte Ptr, mass:Float, matrix:Byte Ptr, boneCollision:Byte Ptr, size:Byte Ptr)

Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneGetUserData:Byte Ptr( bone:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneGetBody:Byte Ptr( bone:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneSetID(bone:Byte Ptr, id:Int)


Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneSetLimits(bone:Byte Ptr, coneDir:Byte Ptr, minConeAngle:Float, maxConeAngle:Float, maxTwistAngle:Float, bilateralConeDir:Byte Ptr, negativeBilateralConeAngle:Float, positiveBilateralConeAngle:Float)
	

Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneGetLocalMatrix(bone:Byte Ptr,  matrix:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonRagDollBoneGetGlobalMatrix( bone:Byte Ptr,  matrix:Byte Ptr)


'================================================
' Vehicle joint functions
'================================================
Rem
bbdoc: la la la
End Rem
Global NewtonConstraintCreateVehicle:Byte Ptr(newtonWorld:Byte Ptr, upDir:Byte Ptr, body:Byte Ptr) 
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleReset(vehicle:Byte Ptr) 
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireCallback(vehicle:Byte Ptr, update:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleAddTire:Int(vehicle:Byte Ptr, localMatrix:Byte Ptr, pin:Byte Ptr, mass:Float, width:Float, radius:Float, suspesionShock:Float, suspesionSpring:Float, suspesionLength:Float, userData:Byte Ptr, collisionID:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleRemoveTire(vehicle:Byte Ptr, tireIndex:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleBalanceTires(vehicle:Byte Ptr, gravityMag:Float)

Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetFirstTireID:Int(vehicle:Byte Ptr)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetNextTireID:Int(vehicle:Byte Ptr, tireId:Int)

Rem
bbdoc: la la la
End Rem
Global NewtonVehicleTireIsAirBorne:Int (vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleTireLostSideGrip:Int(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleTireLostTraction:Int(vehicle:Byte Ptr, tireId:Int)

Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireUserData:Byte Ptr(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireOmega:Float(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireNormalLoad:Float(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireSteerAngle:Float (vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireLateralSpeed:Float(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleGetTireLongitudinalSpeed:Float(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global hicleGetTireMatrix(vehicle:Byte Ptr, tireId:Int , matrix:Byte Ptr)


Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireTorque(vehicle:Byte Ptr, tireId:Int, torque:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireSteerAngle(vehicle:Byte Ptr, tireId:Int,  angle:Float)
	
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireMaxSideSleepSpeed(vehicle:Byte Ptr, tireId:Int, speed:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireSideSleepCoeficient(vehicle:Byte Ptr, tireId:Int,  coeficient:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireMaxLongitudinalSlideSpeed(vehicle:Byte Ptr, tireId:Int, speed:Float)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleSetTireLongitudinalSlideCoeficient(vehicle:Byte Ptr, tireId:Int, coeficient:Float)

Rem
bbdoc: la la la
End Rem
Global NewtonVehicleTireCalculateMaxBrakeAcceleration:Float(vehicle:Byte Ptr, tireId:Int)
Rem
bbdoc: la la la
End Rem
Global NewtonVehicleTireSetBrakeAcceleration(vehicle:Byte Ptr, tireId:Int,  accelaration:Float, torqueLimit:Float)

Rem
bbdoc: la la la
End Rem
Global phBodyGetPitch:Float(body:Int)
Rem
bbdoc: la la la
End Rem
Global phBodyGetYaw:Float(body:Int)
Rem
bbdoc: la la la
End Rem
Global phBodyGetRoll:Float(body:Int)


Rem
bbdoc: la la la
End Rem
Global HLIB_NEWTON:Int

Rem
bbdoc: la la la
End Rem
Function StartNewton:Int()
	If HLIB_NEWTON Return True
	HLIB_NEWTON=LoadLibraryA("bin\Newton.dll")
	If Not HLIB_NEWTON HLIB_NEWTON=LoadLibraryA("dlls\Newton.dll")
	If Not HLIB_NEWTON HLIB_NEWTON=LoadLibraryA("Newton.dll")
	If Not HLIB_NEWTON Return

	'Retrieve function pointers
	
	NewtonWorldForEachBodyInAABBDo=getprocaddress(HLIB_NEWTON,"NewtonWorldForEachBodyInAABBDo")
	
	NewtonTreeCollisionGetVertexListIndexListInAABB=getprocaddress(HLIB_NEWTON,"NewtonTreeCollisionGetVertexListIndexListInAABB")
	NewtonSetPlatformArchitecture=getprocaddress(HLIB_NEWTON,"NewtonSetPlatformArchitecture")
	NewtonCreate=GetProcAddress(HLIB_NEWTON,"NewtonCreate")
	NewtonDestroy=GetProcAddress(HLIB_NEWTON,"NewtonDestroy")
	NewtonUpdate=GetProcAddress(HLIB_NEWTON,"NewtonUpdate")
	NewtonDestroyAllBodies=GetProcAddress(HLIB_NEWTON,"NewtonDestroyAllBodies")
	NewtonSetSolverModel=GetProcAddress(HLIB_NEWTON,"NewtonSetSolverModel")
	NewtonSetFrictionModel=GetProcAddress(HLIB_NEWTON,"NewtonSetFrictionModel")
	NewtonGetTimeStep=GetProcAddress(HLIB_NEWTON,"NewtonGetTimeStep")
	NewtonSetMinimumFrameRate=GetProcAddress(HLIB_NEWTON,"NewtonSetMinimumFrameRate")
	NewtonSetBodyLeaveWorldEvent=GetProcAddress(HLIB_NEWTON,"NewtonSetBodyLeaveWorldEvent")
	NewtonSetWorldSize=GetProcAddress(HLIB_NEWTON,"NewtonSetWorldSize")
	NewtonWorldFreezeBody=GetProcAddress(HLIB_NEWTON,"NewtonWorldFreezeBody")
	NewtonWorldUnfreezeBody=GetProcAddress(HLIB_NEWTON,"NewtonWorldUnfreezeBody")
	NewtonWorldForEachBodyDo=GetProcAddress(HLIB_NEWTON,"NewtonWorldForEachBodyDo")
	NewtonWorldSetUserData=GetProcAddress(HLIB_NEWTON,"NewtonWorldSetUserData")
	NewtonWorldGetUserData=GetProcAddress(HLIB_NEWTON,"NewtonWorldGetUserData")
	NewtonWorldGetVersion=GetProcAddress(HLIB_NEWTON,"NewtonWorldGetVersion")
	NewtonWorldRayCast=GetProcAddress(HLIB_NEWTON,"NewtonWorldRayCast")
	NewtonWorldCollide=GetProcAddress(HLIB_NEWTON,"NewtonWorldCollide")
	NewtonMaterialGetDefaultGroupID=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetDefaultGroupID")
	NewtonMaterialCreateGroupID=GetProcAddress(HLIB_NEWTON,"NewtonMaterialCreateGroupID")
	NewtonMaterialDestroyAllGroupID=GetProcAddress(HLIB_NEWTON,"NewtonMaterialDestroyAllGroupID")
	NewtonMaterialSetDefaultSoftness=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetDefaultSoftness")
	NewtonMaterialSetDefaultElasticity=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetDefaultElasticity")
	NewtonMaterialSetDefaultCollidable=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetDefaultCollidable")
	NewtonMaterialSetDefaultFriction=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetDefaultFriction")
	NewtonMaterialSetCollisionCallback=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetCollisionCallback")
	NewtonMaterialGetUserData=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetUserData")
	NewtonMaterialDisableContact=GetProcAddress(HLIB_NEWTON,"NewtonMaterialDisableContact")
	NewtonMaterialGetCurrentTimestep=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetCurrentTimestep")
	NewtonMaterialGetMaterialPairUserData=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetMaterialPairUserData")
	NewtonMaterialGetContactFaceAttribute=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactFaceAttribute")
	NewtonMaterialGetBodyCollisionID=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetBodyCollisionID")
	NewtonMaterialGetContactNormalSpeed=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactNormalSpeed")
	NewtonMaterialGetContactForce=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactForce")
	NewtonMaterialGetContactPositionAndNormal=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactPositionAndNormal")
	NewtonMaterialGetContactTangentDirections=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactTangentDirections")
	NewtonMaterialGetContactTangentSpeed=GetProcAddress(HLIB_NEWTON,"NewtonMaterialGetContactTangentSpeed")
	NewtonMaterialSetContactSoftness=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactSoftness")
	NewtonMaterialSetContactElasticity=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactElasticity")
	NewtonMaterialSetContactFrictionState=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactFrictionState")
	NewtonMaterialSetContactStaticFrictionCoef=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactStaticFrictionCoef")
	NewtonMaterialSetContactKineticFrictionCoef=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactKineticFrictionCoef")
	NewtonMaterialSetContactTangentAcceleration=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactTangentAcceleration")
	NewtonMaterialContactRotateTangentDirections=GetProcAddress(HLIB_NEWTON,"NewtonMaterialContactRotateTangentDirections")
	NewtonCreateNull=GetProcAddress(HLIB_NEWTON,"NewtonCreateNull")
	NewtonCreateSphere=GetProcAddress(HLIB_NEWTON,"NewtonCreateSphere")
	NewtonCreateBox=GetProcAddress(HLIB_NEWTON,"NewtonCreateBox")
	NewtonCreateCone=GetProcAddress(HLIB_NEWTON,"NewtonCreateCone")
	NewtonCreateCapsule=GetProcAddress(HLIB_NEWTON,"NewtonCreateCapsule")
	NewtonCreateCylinder=GetProcAddress(HLIB_NEWTON,"NewtonCreateCylinder")
	NewtonCreateChamferCylinder=GetProcAddress(HLIB_NEWTON,"NewtonCreateChamferCylinder")
	NewtonCreateConvexHull=GetProcAddress(HLIB_NEWTON,"NewtonCreateConvexHull")
	NewtonCreateConvexHullModifier=GetProcAddress(HLIB_NEWTON,"NewtonCreateConvexHullModifier")
	NewtonConvexHullModifierGetMatrix=GetProcAddress(HLIB_NEWTON,"NewtonConvexHullModifierGetMatrix")
	NewtonConvexHullModifierSetMatrix=GetProcAddress(HLIB_NEWTON,"NewtonConvexHullModifierSetMatrix")
	NewtonConvexCollisionSetUserID=GetProcAddress(HLIB_NEWTON,"NewtonConvexCollisionSetUserID")
	NewtonConvexCollisionGetUserID=GetProcAddress(HLIB_NEWTON,"NewtonConvexCollisionGetUserID")
	NewtonCreateCompoundCollision=GetProcAddress(HLIB_NEWTON,"NewtonCreateCompoundCollision")
	NewtonCreateUserMeshCollision=GetProcAddress(HLIB_NEWTON,"NewtonCreateUserMeshCollision")
	NewtonCreateTreeCollision=GetProcAddress(HLIB_NEWTON,"NewtonCreateTreeCollision")
	NewtonTreeCollisionBeginBuild=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionBeginBuild")
	NewtonTreeCollisionAddFace=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionAddFace")
	NewtonTreeCollisionEndBuild=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionEndBuild")
	NewtonTreeCollisionSerialize=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionSerialize")
	NewtonCreateTreeCollisionFromSerialization=GetProcAddress(HLIB_NEWTON,"NewtonCreateTreeCollisionFromSerialization")
	NewtonTreeCollisionGetFaceAtribute=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionGetFaceAtribute")
	NewtonTreeCollisionSetFaceAtribute=GetProcAddress(HLIB_NEWTON,"NewtonTreeCollisionSetFaceAtribute")
	NewtonReleaseCollision=GetProcAddress(HLIB_NEWTON,"NewtonReleaseCollision")
	NewtonCollisionCalculateAABB=GetProcAddress(HLIB_NEWTON,"NewtonCollisionCalculateAABB")
	NewtonCollisionRayCast=GetProcAddress(HLIB_NEWTON,"NewtonCollisionRayCast")
	NewtonGetEulerAngle=GetProcAddress(HLIB_NEWTON,"NewtonGetEulerAngle")
	NewtonSetEulerAngle=GetProcAddress(HLIB_NEWTON,"NewtonSetEulerAngle")
	NewtonCollisionMakeUnique=GetProcAddress(HLIB_NEWTON,"NewtonCollisionMakeUnique")
	NewtonCreateBody=GetProcAddress(HLIB_NEWTON,"NewtonCreateBody")
	NewtonDestroyBody=GetProcAddress(HLIB_NEWTON,"NewtonDestroyBody")
	NewtonBodyAddForce=GetProcAddress(HLIB_NEWTON,"NewtonBodyAddForce")
	NewtonBodyAddTorque=GetProcAddress(HLIB_NEWTON,"NewtonBodyAddTorque")
	NewtonBodySetMatrix=GetProcAddress(HLIB_NEWTON,"NewtonBodySetMatrix")
	NewtonBodySetMatrixRecursive=GetProcAddress(HLIB_NEWTON,"NewtonBodySetMatrixRecursive")
	NewtonBodySetMassMatrix=GetProcAddress(HLIB_NEWTON,"NewtonBodySetMassMatrix")
	NewtonBodySetMaterialGroupID=GetProcAddress(HLIB_NEWTON,"NewtonBodySetMaterialGroupID")
	NewtonBodySetContinuousCollisionMode=GetProcAddress(HLIB_NEWTON,"NewtonBodySetContinuousCollisionMode")
	NewtonBodySetJointRecursiveCollision=GetProcAddress(HLIB_NEWTON,"NewtonBodySetJointRecursiveCollision")
	NewtonBodySetOmega=GetProcAddress(HLIB_NEWTON,"NewtonBodySetOmega")
	NewtonBodySetVelocity=GetProcAddress(HLIB_NEWTON,"NewtonBodySetVelocity")
	NewtonBodySetForce=GetProcAddress(HLIB_NEWTON,"NewtonBodySetForce")
	NewtonBodySetTorque=GetProcAddress(HLIB_NEWTON,"NewtonBodySetTorque")
	NewtonBodySetLinearDamping=GetProcAddress(HLIB_NEWTON,"NewtonBodySetLinearDamping")
	NewtonBodySetAngularDamping=GetProcAddress(HLIB_NEWTON,"NewtonBodySetAngularDamping")
	NewtonBodySetUserData=GetProcAddress(HLIB_NEWTON,"NewtonBodySetUserData")
	NewtonBodyCoriolisForcesMode=GetProcAddress(HLIB_NEWTON,"NewtonBodyCoriolisForcesMode")
	NewtonBodySetCollision=GetProcAddress(HLIB_NEWTON,"NewtonBodySetCollision")
	NewtonBodySetAutoFreeze=GetProcAddress(HLIB_NEWTON,"NewtonBodySetAutoFreeze")
	NewtonBodySetFreezeTreshold=GetProcAddress(HLIB_NEWTON,"NewtonBodySetFreezeTreshold")
	NewtonBodySetTransformCallback=GetProcAddress(HLIB_NEWTON,"NewtonBodySetTransformCallback")
	NewtonBodySetDestructorCallback=GetProcAddress(HLIB_NEWTON,"NewtonBodySetDestructorCallback")
	NewtonBodySetAutoactiveCallback=GetProcAddress(HLIB_NEWTON,"NewtonBodySetAutoactiveCallback")
	NewtonBodySetForceAndTorqueCallback=GetProcAddress(HLIB_NEWTON,"NewtonBodySetForceAndTorqueCallback")
	NewtonBodyGetWorld=GetProcAddress(HLIB_NEWTON,"	NewtonBodyGetWorld")
	NewtonBodyGetUserData=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetUserData")
	NewtonBodyGetCollision=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetCollision")
	NewtonBodyGetMaterialGroupID=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetMaterialGroupID")
	NewtonBodyGetContinuousCollisionMode=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetContinuousCollisionMode")
	NewtonBodyGetJointRecursiveCollision=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetJointRecursiveCollision")
	NewtonBodyGetMatrix=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetMatrix")
	NewtonBodyGetMassMatrix=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetMassMatrix")
	NewtonBodyGetInvMass=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetInvMass")
	NewtonBodyGetOmega=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetOmega")
	NewtonBodyGetVelocity=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetVelocity")
	NewtonBodyGetForce=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetForce")
	NewtonBodyGetTorque=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetTorque")
	NewtonBodyGetSleepingState=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetSleepingState")
	NewtonBodyGetAutoFreeze=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetAutoFreeze")
	NewtonBodyGetLinearDamping=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetLinearDamping")
	NewtonBodyGetAngularDamping=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetAngularDamping")
	NewtonBodyGetAABB=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetAABB")
	NewtonBodyGetFreezeTreshold=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetFreezeTreshold")
	NewtonBodyGetTotalVolume=GetProcAddress(HLIB_NEWTON,"NewtonBodyGetTotalVolume")
	NewtonBodyAddBuoyancyForce=GetProcAddress(HLIB_NEWTON,"NewtonBodyAddBuoyancyForce")
	NewtonBodyForEachPolygonDo=GetProcAddress(HLIB_NEWTON,"NewtonBodyForEachPolygonDo")
	NewtonAddBodyImpulse=GetProcAddress(HLIB_NEWTON,"NewtonAddBodyImpulse")
	NewtonJointGetUserData=GetProcAddress(HLIB_NEWTON,"NewtonJointGetUserData")
	NewtonJointSetUserData=GetProcAddress(HLIB_NEWTON,"NewtonJointSetUserData")
	NewtonJointGetCollisionState=GetProcAddress(HLIB_NEWTON,"NewtonJointGetCollisionState")
	NewtonJointSetCollisionState=GetProcAddress(HLIB_NEWTON,"NewtonJointSetCollisionState")
	NewtonJointGetStiffness=GetProcAddress(HLIB_NEWTON,"NewtonJointGetStiffness")
	NewtonJointSetStiffness=GetProcAddress(HLIB_NEWTON,"NewtonJointSetStiffness")
	NewtonDestroyJoint=GetProcAddress(HLIB_NEWTON,"NewtonDestroyJoint")
	NewtonJointSetDestructor=GetProcAddress(HLIB_NEWTON,"NewtonJointSetDestructor")
	NewtonConstraintCreateBall=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateBall")
	NewtonBallSetUserCallback=GetProcAddress(HLIB_NEWTON,"NewtonBallSetUserCallback")
	NewtonBallGetJointAngle=GetProcAddress(HLIB_NEWTON,"NewtonBallGetJointAngle")
	NewtonBallGetJointOmega=GetProcAddress(HLIB_NEWTON,"NewtonBallGetJointOmega")
	NewtonBallGetJointForce=GetProcAddress(HLIB_NEWTON,"NewtonBallGetJointForce")
	NewtonBallSetConeLimits=GetProcAddress(HLIB_NEWTON,"NewtonBallSetConeLimits")
	NewtonConstraintCreateHinge=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateHinge")
	NewtonHingeSetUserCallback=GetProcAddress(HLIB_NEWTON,"NewtonHingeSetUserCallback")
	NewtonHingeGetJointAngle=GetProcAddress(HLIB_NEWTON,"NewtonHingeGetJointAngle")
	NewtonHingeGetJointOmega=GetProcAddress(HLIB_NEWTON,"NewtonHingeGetJointOmega")
	NewtonHingeGetJointForce=GetProcAddress(HLIB_NEWTON,"NewtonHingeGetJointForce")
	NewtonHingeCalculateStopAlpha=GetProcAddress(HLIB_NEWTON,"NewtonHingeCalculateStopAlpha")
	NewtonConstraintCreateSlider=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateSlider")
	NewtonSliderSetUserCallback=GetProcAddress(HLIB_NEWTON,"NewtonSliderSetUserCallback")
	NewtonSliderGetJointPosit=GetProcAddress(HLIB_NEWTON,"NewtonSliderGetJointPosit")
	NewtonSliderGetJointVeloc=GetProcAddress(HLIB_NEWTON,"NewtonSliderGetJointVeloc")
	NewtonSliderGetJointForce=GetProcAddress(HLIB_NEWTON,"NewtonSliderGetJointForce")
	NewtonSliderCalculateStopAccel=GetProcAddress(HLIB_NEWTON,"NewtonSliderCalculateStopAccel")
	NewtonConstraintCreateCorkscrew=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateCorkscrew")
	NewtonCorkscrewSetUserCallback=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewSetUserCallback")
	NewtonCorkscrewGetJointPosit=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewGetJointPosit")
	NewtonCorkscrewGetJointAngle=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewGetJointAngle")
	NewtonCorkscrewGetJointVeloc=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewGetJointVeloc")
	NewtonCorkscrewGetJointOmega=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewGetJointOmega")
	NewtonCorkscrewGetJointForce=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewGetJointForce")
	NewtonCorkscrewCalculateStopAlpha=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewCalculateStopAlpha")
	NewtonCorkscrewCalculateStopAccel=GetProcAddress(HLIB_NEWTON,"NewtonCorkscrewCalculateStopAccel")
	NewtonConstraintCreateUniversal=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateUniversal")
	NewtonUniversalSetUserCallback=GetProcAddress(HLIB_NEWTON,"NewtonUniversalSetUserCallback")
	NewtonUniversalGetJointAngle0=GetProcAddress(HLIB_NEWTON,"NewtonUniversalGetJointAngle0")
	NewtonUniversalGetJointAngle1=GetProcAddress(HLIB_NEWTON,"NewtonUniversalGetJointAngle1")
	NewtonUniversalGetJointOmega0=GetProcAddress(HLIB_NEWTON,"NewtonUniversalGetJointOmega0")
	NewtonUniversalGetJointOmega1=GetProcAddress(HLIB_NEWTON,"NewtonUniversalGetJointOmega1")
	NewtonUniversalGetJointForce=GetProcAddress(HLIB_NEWTON,"NewtonUniversalGetJointForce")
	NewtonUniversalCalculateStopAlpha0=GetProcAddress(HLIB_NEWTON,"NewtonUniversalCalculateStopAlpha0")
	NewtonUniversalCalculateStopAlpha1=GetProcAddress(HLIB_NEWTON,"NewtonUniversalCalculateStopAlpha1")
	NewtonConstraintCreateUpVector=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateUpVector")
	NewtonUpVectorGetPin=GetProcAddress(HLIB_NEWTON,"NewtonUpVectorGetPin")
	NewtonUpVectorSetPin=GetProcAddress(HLIB_NEWTON,"NewtonUpVectorSetPin")
	NewtonConstraintCreateUserJoint=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateUserJoint")
	NewtonUserJointAddLinearRow=GetProcAddress(HLIB_NEWTON,"NewtonUserJointAddLinearRow")
	NewtonUserJointAddAngularRow=GetProcAddress(HLIB_NEWTON,"NewtonUserJointAddAngularRow")
	NewtonUserJointSetRowMinimunFriction=GetProcAddress(HLIB_NEWTON,"NewtonUserJointSetRowMinimunFriction")
	NewtonUserJointSetRowMaximunFriction=GetProcAddress(HLIB_NEWTON,"NewtonUserJointSetRowMaximunFriction")
	NewtonUserJointSetRowAcceleration=GetProcAddress(HLIB_NEWTON,"NewtonUserJointSetRowAcceleration")
	NewtonUserJointSetRowStiffness=GetProcAddress(HLIB_NEWTON,"NewtonUserJointSetRowStiffness")
	NewtonUserJointGetRowForce=GetProcAddress(HLIB_NEWTON,"NewtonUserJointGetRowForce")
	NewtonCreateRagDoll=GetProcAddress(HLIB_NEWTON,"NewtonCreateRagDoll")
	NewtonDestroyRagDoll=GetProcAddress(HLIB_NEWTON,"NewtonDestroyRagDoll")
	NewtonRagDollBegin=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBegin")
	NewtonRagDollEnd=GetProcAddress(HLIB_NEWTON,"NewtonRagDollEnd")
	NewtonRagDollFindBone=GetProcAddress(HLIB_NEWTON,"NewtonRagDollFindBone")
	NewtonRagDollGetRootBone=GetProcAddress(HLIB_NEWTON,"NewtonRagDollGetRootBone")
	NewtonRagDollSetForceAndTorqueCallback=GetProcAddress(HLIB_NEWTON,"NewtonRagDollSetForceAndTorqueCallback")
	NewtonRagDollSetTransformCallback=GetProcAddress(HLIB_NEWTON,"NewtonRagDollSetTransformCallback")
	NewtonRagDollAddBone=GetProcAddress(HLIB_NEWTON,"NewtonRagDollAddBone")
	NewtonRagDollBoneGetUserData=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneGetUserData")
	NewtonRagDollBoneGetBody=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneGetBody")
	NewtonRagDollBoneSetID=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneSetID")
	NewtonRagDollBoneSetLimits=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneSetLimits")
	NewtonRagDollBoneGetLocalMatrix=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneGetLocalMatrix")
	NewtonRagDollBoneGetGlobalMatrix=GetProcAddress(HLIB_NEWTON,"NewtonRagDollBoneGetGlobalMatrix")
	NewtonConstraintCreateVehicle=GetProcAddress(HLIB_NEWTON,"NewtonConstraintCreateVehicle")
	NewtonVehicleReset=GetProcAddress(HLIB_NEWTON,"NewtonVehicleReset")
	NewtonVehicleSetTireCallback=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireCallback")
	NewtonVehicleAddTire=GetProcAddress(HLIB_NEWTON,"NewtonVehicleAddTire")
	NewtonVehicleRemoveTire=GetProcAddress(HLIB_NEWTON,"NewtonVehicleRemoveTire")
	NewtonVehicleBalanceTires=GetProcAddress(HLIB_NEWTON,"NewtonVehicleBalanceTires")
	NewtonVehicleGetFirstTireID=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetFirstTireID")
	NewtonVehicleGetNextTireID=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetNextTireID")
	NewtonVehicleTireIsAirBorne=GetProcAddress(HLIB_NEWTON,"NewtonVehicleTireIsAirBorne")
	NewtonVehicleTireLostSideGrip=GetProcAddress(HLIB_NEWTON,"NewtonVehicleTireLostSideGrip")
	NewtonVehicleTireLostTraction=GetProcAddress(HLIB_NEWTON,"NewtonVehicleTireLostTraction")
	NewtonVehicleGetTireUserData=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireUserData")
	NewtonVehicleGetTireOmega=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireOmega")
	NewtonVehicleGetTireNormalLoad=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireNormalLoad")
	NewtonVehicleGetTireSteerAngle=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireSteerAngle")
	NewtonVehicleGetTireLateralSpeed=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireLateralSpeed")
	NewtonVehicleGetTireLongitudinalSpeed=GetProcAddress(HLIB_NEWTON,"NewtonVehicleGetTireLongitudinalSpeed")
	hicleGetTireMatrix=GetProcAddress(HLIB_NEWTON,"hicleGetTireMatrix")
	NewtonVehicleSetTireTorque=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireTorque")
	NewtonVehicleSetTireSteerAngle=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireSteerAngle")
	NewtonVehicleSetTireMaxSideSleepSpeed=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireMaxSideSleepSpeed")
	NewtonVehicleSetTireSideSleepCoeficient=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireSideSleepCoeficient")
	NewtonVehicleSetTireMaxLongitudinalSlideSpeed=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireMaxLongitudinalSlideSpeed")
	NewtonVehicleSetTireLongitudinalSlideCoeficient=GetProcAddress(HLIB_NEWTON,"NewtonVehicleSetTireLongitudinalSlideCoeficient")
	NewtonVehicleTireCalculateMaxBrakeAcceleration=GetProcAddress(HLIB_NEWTON,"NewtonVehicleTireCalculateMaxBrakeAcceleration")
	NewtonVehicleTireSetBrakeAcceleration=GetProcAddress(HLIB_NEWTON,"NewtonVehicleTireSetBrakeAcceleration")
	NewtonMaterialSetContactNormalDirection=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactNormalDirection")
	NewtonMaterialSetContactNormalAcceleration=GetProcAddress(HLIB_NEWTON,"NewtonMaterialSetContactNormalAcceleration")
	NewtonCollisionCollide=GetProcAddress(HLIB_NEWTON,"NewtonCollisionCollide")
	NewtonBodySetCentreOfMass=GetProcAddress(HLIB_NEWTON,"NewtonBodySetCentreOfMass")
	NewtonConvexCollisionCalculateInertialMatrix=GetProcAddress(HLIB_NEWTON,"NewtonConvexCollisionCalculateInertialMatrix")
	Return True
EndFunction

Rem
bbdoc: la la la
End Rem
Function StopNewton()
	If HLIB_NEWTON
		'NewtonDestroy NP_WORLD
		'NP_WORLD=Null
		FreeLibrary HLIB_NEWTON
		HLIB_NEWTON=0
	EndIf
EndFunction