Newton Game Dynamics module

BlitzMax Forums/BlitzMax Programming/Newton Game Dynamics module

JoshK(Posted 2006) [#1]
Call StartNewton() to initialize and StopNewton() to end.

'Uncomment this block to compile as a module:
Rem
Module Pub.Newton

Import Pub.Win32
Extern
	Function FreeLibrary(hlib)="FreeLibrary@4"
EndExtern
EndRem

'================================================
' World Functions
'================================================
Global NewtonCreate:Byte Ptr( mallocFnt: Byte Ptr, mfreeFnt:Byte Ptr)
Global NewtonDestroy(nWorld: Byte Ptr)
Global NewtonUpdate(newtonWorld: Byte Ptr, time:Float)
Global NewtonDestroyAllBodies(newtonWorld: Byte Ptr)
Global NewtonSetSolverModel(newtonWorld:Byte Ptr, model:Int)
Global NewtonSetFrictionModel(newtonWorld:Byte Ptr, model:Int)
Global NewtonGetTimeStep:Float(newtonWorld:Byte Ptr)
Global NewtonSetMinimumFrameRate(newtonWorld:Byte Ptr, frameRate:Float)
Global NewtonSetBodyLeaveWorldEvent(newtonWorld:Byte Ptr, BodyLeaveWorld_callback:Byte Ptr)
Global NewtonSetWorldSize(newtonWorld: Byte Ptr, minPoint: Byte Ptr, maxPoint:Byte Ptr)
Global NewtonWorldFreezeBody(newtonWorld:Byte Ptr, body:Byte Ptr)
Global NewtonWorldUnfreezeBody(newtonWorld: Byte Ptr, body:Byte Ptr)
Global NewtonWorldForEachBodyDo(newtonWorld:Byte Ptr, BodyIterator_callback:Byte Ptr)
Global NewtonWorldSetUserData(newtonWorld:Byte Ptr, userData:Byte Ptr)
Global NewtonWorldGetUserData:Byte Ptr(newtonWorld:Byte Ptr)
Global NewtonWorldGetVersion:Int(newtonWorld:Byte Ptr)
Global NewtonWorldRayCast(newtonWorld:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr, WorldRayFilterCallback:Byte Ptr, userData:Byte Ptr)
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)
Global NewtonMaterialGetDefaultGroupID:Int(newtonWorld:Byte Ptr)
Global NewtonMaterialCreateGroupID:Int(newtonWorld:Byte Ptr)
Global NewtonMaterialDestroyAllGroupID(newtonWorld:Byte Ptr)
Global NewtonMaterialSetDefaultSoftness(newtonWorld:Byte Ptr, id0:Int, id1:Int, value:Float)
Global NewtonMaterialSetDefaultElasticity(newtonWorld:Byte Ptr, id0:Int, id1:Int, elasticCoef:Float)
Global NewtonMaterialSetDefaultCollidable(newtonWorld:Byte Ptr, id0:Int, id1:Int, state:Int)
Global NewtonMaterialSetDefaultFriction(newtonWorld:Byte Ptr, id0:Int, id1:Int, staticFriction:Float, kineticFriction:Float)
Global NewtonMaterialSetCollisionCallback(newtonWorld:Byte Ptr, id0:Int, id1:Int, userData:Byte Ptr, begin:Byte Ptr, process:Byte Ptr, NEnd:Byte Ptr)
Global NewtonMaterialGetUserData:Byte Ptr(newtonWorld:Byte Ptr, id0:Int, id1:Int)
Global NewtonMaterialDisableContact (material:Byte Ptr)
Global NewtonMaterialGetCurrentTimestep:Float(material:Byte Ptr)
Global NewtonMaterialGetMaterialPairUserData:Byte Ptr(material:Byte Ptr)
Global NewtonMaterialGetContactFaceAttribute:Int(material: Byte Ptr)
Global NewtonMaterialGetBodyCollisionID:Int(material: Byte Ptr, body:Byte Ptr)
Global NewtonMaterialGetContactNormalSpeed:Float(material:Byte Ptr, contactlHandle:Byte Ptr)
Global NewtonMaterialGetContactForce(material: Byte Ptr, force:Byte Ptr)
Global NewtonMaterialGetContactPositionAndNormal(material:Byte Ptr, posit:Byte Ptr, normal:Byte Ptr)
Global NewtonMaterialGetContactTangentDirections(material:Byte Ptr, dir0:Byte Ptr, dir:Byte Ptr)
Global NewtonMaterialGetContactTangentSpeed:Float(material:Byte Ptr, NewtonContact:Byte Ptr, index:Int)

Global NewtonSetPlatformArchitecture(world:Byte Ptr,mode:Int)

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

Global NewtonMaterialContactRotateTangentDirections(NewtonMaterial:Byte Ptr, directionVector:Byte Ptr)

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

'================================================
'complex collision primitives creation functions
'================================================
Global NewtonCreateCompoundCollision:Byte Ptr(newtonWorld:Byte Ptr, count:Int, collisionPrimitiveArray:Byte Ptr[])
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
'================================================
Global NewtonCreateTreeCollision:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr)
Global NewtonTreeCollisionBeginBuild(NewtonCollision: Byte Ptr)
Global NewtonTreeCollisionAddFace(NewtonCollision: Byte Ptr, vertexCount:Int, vertexPtr: Byte Ptr, strideInBytes:Int, faceAttribute:Int)
Global NewtonTreeCollisionEndBuild(NewtonCollision: Byte Ptr, optimize:Int)
'	NEWTON_API void NewtonTreeCollisionSerialize (Const NewtonCollision* treeCollision, NewtonSerialize serializeFunction, 
'		void* serializeHandle);
Global NewtonCreateTreeCollisionFromSerialization:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr,deserializeFunction:Byte Ptr, serializeHandle:Byte Ptr)
Global NewtonTreeCollisionGetFaceAtribute:Int(NewtonCollision:Byte Ptr, faceIndexArray:Byte Ptr) 
Global NewtonTreeCollisionSetFaceAtribute(NewtonCollision: Byte Ptr, faceIndexArray: Byte Ptr, attribute:Int) 

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

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

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

Global NewtonBodyAddForce(body:Byte Ptr, force:Byte Ptr)
Global NewtonBodyAddTorque(body:Byte Ptr, torque:Byte Ptr)

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

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

Global NewtonBodyForEachPolygonDo (body:Byte Ptr, CollisionIterator_callback:Byte Ptr)
Global NewtonAddBodyImpulse(body:Byte Ptr, pointDeltaVeloc:Byte Ptr, pointPosit:Byte Ptr)

'================================================
' Common joint funtions
'================================================
Global NewtonJointGetUserData:Byte Ptr(joint:Byte Ptr)
Global NewtonJointSetUserData(joint:Byte Ptr, userData:Byte Ptr)

Global NewtonJointGetCollisionState:Int(joint:Byte Ptr)
Global NewtonJointSetCollisionState(joint:Byte Ptr, state:Int)

Global NewtonJointGetStiffness:Float(joint:Byte Ptr)
Global NewtonJointSetStiffness(joint:Byte Ptr, state:Float)

Global NewtonDestroyJoint(newtonWorld:Byte Ptr, joint:Byte Ptr)
Global NewtonJointSetDestructor(joint:Byte Ptr, destructor:Byte Ptr)

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

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

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


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


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


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


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


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


'================================================
' Ragdoll joint contatiner funtion
'================================================
Global NewtonCreateRagDoll:Byte Ptr(newtonWorld:Byte Ptr)
Global NewtonDestroyRagDoll(newtonWorld:Byte Ptr, ragDoll:Byte Ptr)

Global NewtonRagDollBegin( ragDoll:Byte Ptr)
Global NewtonRagDollEnd( ragDoll:Byte Ptr)


Global NewtonRagDollFindBone:Byte Ptr( ragDoll:Byte Ptr, id:Int)
Global NewtonRagDollGetRootBone:Byte Ptr( ragDoll:Byte Ptr)

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

Global NewtonRagDollBoneGetUserData:Byte Ptr( bone:Byte Ptr)
Global NewtonRagDollBoneGetBody:Byte Ptr( bone:Byte Ptr)
Global NewtonRagDollBoneSetID(bone:Byte Ptr, id:Int)


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

Global NewtonRagDollBoneGetLocalMatrix(bone:Byte Ptr,  matrix:Byte Ptr)
Global NewtonRagDollBoneGetGlobalMatrix( bone:Byte Ptr,  matrix:Byte Ptr)


'================================================
' Vehicle joint functions
'================================================
Global NewtonConstraintCreateVehicle:Byte Ptr(newtonWorld:Byte Ptr, upDir:Byte Ptr, body:Byte Ptr) 
Global NewtonVehicleReset(vehicle:Byte Ptr) 
Global NewtonVehicleSetTireCallback(vehicle:Byte Ptr, update:Byte Ptr)
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)
Global NewtonVehicleRemoveTire(vehicle:Byte Ptr, tireIndex:Int)
Global NewtonVehicleBalanceTires(vehicle:Byte Ptr, gravityMag:Float)

Global NewtonVehicleGetFirstTireID:Int(vehicle:Byte Ptr)
Global NewtonVehicleGetNextTireID:Int(vehicle:Byte Ptr, tireId:Int)

Global NewtonVehicleTireIsAirBorne:Int (vehicle:Byte Ptr, tireId:Int)
Global NewtonVehicleTireLostSideGrip:Int(vehicle:Byte Ptr, tireId:Int)
Global NewtonVehicleTireLostTraction:Int(vehicle:Byte Ptr, tireId:Int)

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


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

Global NewtonVehicleTireCalculateMaxBrakeAcceleration:Float(vehicle:Byte Ptr, tireId:Int)
Global NewtonVehicleTireSetBrakeAcceleration(vehicle:Byte Ptr, tireId:Int,  accelaration:Float, torqueLimit:Float)

Global phBodyGetPitch:Float(body:Int)
Global phBodyGetYaw:Float(body:Int)
Global phBodyGetRoll:Float(body:Int)


Global HLIB_NEWTON

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
	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")
	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")
	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")
	Return True
EndFunction

Function StopNewton()
	If HLIB_NEWTON
		'NewtonDestroy NP_WORLD
		'NP_WORLD=Null
		FreeLibrary HLIB_NEWTON
		HLIB_NEWTON=0
	EndIf
EndFunction



Dreamora(Posted 2006) [#2]
definitely great.
Thank you very much for sharing this one :)


ImaginaryHuman(Posted 2006) [#3]
1) Is this cross platform?
2) Does it need some other files included (from where)?
3) Where is documentation?

:-)


popcade(Posted 2006) [#4]
Thanks, halo :)

Which version of Newton does this use?
Statically or dynamically linked?


Picklesworth(Posted 2006) [#5]
Excellent :)

I was a bit bothered by using that other one because it looked completely forgotten, hidden away in a web site. It was full of weird code, too.

This one is very good!

AngelDaniel: The documentation should come with Newton.


JoshK(Posted 2006) [#6]
You need Newton.dll, either in the program folder, or in a "bin" or "dlls" subfolder. Newton also includes a .lib file, but I don't know if that can be imported, so I don't know how to statically link it.

I've tried every physics system except Havok, and I think Newton is the best.


Picklesworth(Posted 2006) [#7]
Newton is cross platform. The wrapper would need some (hopefully not much!) extra fiddling to get it like that, though, since only Windows uses DLLs.

I agree, Newton is great!
Its convex hull support is really well done, and it's very reliable. I have never seen it do any of that crazy stuttering followed by objects flying into the air, which plagues engines like Tokamak.
I had a hard time deciding for what I am working on, since it is built entirely around a physics engine (thus the slightest stutter would really annoy people), and I'm almost completely decided on Newton.


Sweenie(Posted 2006) [#8]
And with the upcoming 1.6 version it will be even better.
It's supposed to gone through major speed optimizations and is also supposed to feature hardware accelerated physics by using the GPU(ala Havok).


Dreamora(Posted 2006) [#9]
that actually would be a really nice usage for us indie devs who don't waste time on writting that many high end shaders and thus have quite some shader power left for important stuff :)


Armitage 1982(Posted 2006) [#10]
I've just post about another physical system ("Adapt physical to Bmax").
Newton is probably oriented to 3D game.
May i ask in wich way this library can be use with a 2D simulation ? Do we have to fake 2.5 D and stick Z depth or is there any 2D "built-in" solution ?

Thanks though !


ninjarat(Posted 2007) [#11]
Hey, I know this thread is aging, but the stuff works fine... does anyone have an example of this baby in action?


klepto2(Posted 2007) [#12]
I'm currently adding an abtract layer with this module for minib3d. It comes along nicely and I think I will release the first Version on friday or saturday. So you could have a look to the source then how to handle the rotations etc. .

Mainly to give you a hint how to use:
http://www.blitzbasic.com/Community/posts.php?topic=51229#571413


ninjarat(Posted 2007) [#13]
Hmm, doesn't work on the latest version. Got anything more recent?

Thanks.