Topic: Strange rotation

Hi, I have an odd problem, when I create a sphere in Irrlicht and rotate it along the x and y, pitch and yaw the sphere turns 180 and then back 180 and so on, that's in both directions too, yet, the roll (z) works fine in both directions??

Re: Strange rotation

ill take a peek hopefully tonight.  been real busy of late neutral

Re: Strange rotation

No problem, I know it's something to do with quaternions but I'm not sure how to set this up using Irrlicht?  Seems to be a problem with Euler or something?

Re: Strange rotation

Okay I dont think it has anything to do with Quatonians now, I've just used Euler to Quat code and it makes no difference!  I think it's to do with Blitzmax rotations being different to Blitz3D.  This is a BIG issue here really, I cant believe noone else has had this issue appart from me??!!  I cant hardly find any info online either, like my sphere only rotates 180 then ping pongs back 180.

Re: Strange rotation

This is the closest I've got to actually having an effect on the rotating, here it only rotates 90 degree each way, I know it's clearly not a fix but at least this actually changes something sad

If pitch<0 Then pitch=0-pitch-(Int((0-pitch)/360)*360)

If yaw<0 Then yaw=0-yaw-(Int((0-yaw)/360)*360)

If roll<0 Then roll=0-roll-(Int((0-roll)/360)*360)

Re: Strange rotation

hi slaine.  can you post the sample code your running?  will help in the troubleshooting.

Re: Strange rotation

Okay here is a simple sphere rolling down an inclined object, you will need to use a texture which will show rotation clearly.

Strict
Framework BRL.Blitz
Import BRL.StandardIO
Import Irrlicht.Core    'Allows Irrlicht
Import "PhysX_func.bmx"

Global VECTOR_Y#
Global VECTOR_Z#
Global VECTOR_W#
Global VECTOR_X#
Global x#,y#,z#
Local grid#[3,3]

Local driverType:Int=EDT_NULL
driverType = EDT_DIRECT3D8

Local device:IrrlichtDevice= ..
    IrrlichtDevice.create(driverType,_DIMENSION2DI(800,600),16,False,True)

Global driver:IVideoDriver=device.getVideoDriver()
Global smgr:ISceneManager=device.getSceneManager()

'create camera
Local camera:ICameraSceneNode = smgr.addCameraSceneNodeFPS()
camera.setPosition(_VECTOR3DF(0,30,-100))

'create light
Local light_node:ISceneNode = smgr.addLightSceneNode(Null, _VECTOR3DF(+100,150,-10), ..
    _SCOLORF(1.0, 0.6, 0.7, 1.0), 200.0)

'create sphere
Local sphere_node:ISceneNode = smgr.addSphereSceneNode()
sphere_node.setPosition(_VECTOR3DF(0,30,0))
sphere_node.SetScale(_VECTOR3DF(2,2,2))
sphere_node.setMaterialTexture(0,driver.getTexture("media/text.jpg"))

'create floor
Local floor_node:ISceneNode = smgr.addCubeSceneNode()
floor_node.setPosition(_VECTOR3DF(0,-10,0))
floor_node.SetScale(_VECTOR3DF(10,1,10))

'physic
Local dir$ = CurrentDir ()
dir = Replace$( dir$,"/","\" )
pxRegWriteDriverPath (dir.ToCString())

PxCreateWorld(0, "key")
pxSetGravity(0, -10, 0)
pxRegWriteDriverPath ("C:\Program Files\AGEIA Technologies".ToCString())


Local planeBody = PxBodyCreateCube(50,1,50, 0)
pxBodySetPosition(planeBody ,0,-1,0)
pxBodySetRotation(planeBody ,-0.5,0,0)

Local sphereBody = PxBodyCreateSphere(4, 10)
pxBodySetPosition(sphereBody,0, 30, 0)


While(device.run())
    If (device.isWindowActive())
    
    driver.beginScene(True, True, Null)
    
        
    sphere_node.setPosition(_VECTOR3DF(pxBodyGetPositionX(sphereBody),pxBodyGetPositionY(sphereBody),pxBodyGetPositionZ(sphereBody)))
    sphere_node.setRotation(_VECTOR3DF(pxBodyGetRotationPitch(sphereBody),pxBodyGetRotationYaw(sphereBody),pxBodyGetRotationRoll(sphereBody)))
    
    smgr.drawAll()
            
    pxRenderPhysic(30, 0)
    
    driver.endScene()
    EndIf    
Wend    
    
device.drop()

Re: Strange rotation

With the help from Render who wrote the PhysX wrapper the problem appears to be with Irrlicht's rotate function, with this code the sphere rotates a few 360's but then back 90 degrees then another further few 360's, so there maybe a glitch with Irrlicht.

ePitch # = pxBodyGetRotationPitch (sphereBody)
    eYaw # = pxBodyGetRotationYaw (sphereBody)
    eRoll # = pxBodyGetRotationRoll (sphereBody)

   If eYaw =-180 And eRoll=180
      eRoll=0
      eYaw=0
      ePitch = 180 - ePitch 
   EndIf

    sphere_node.setPosition (_VECTOR3DF (pxBodyGetPositionX (sphereBody), pxBodyGetPositionY (sphereBody), pxBodyGetPositionZ (sphereBody)))
    sphere_node.setRotation (_VECTOR3DF (ePitch, eYaw, eRoll))

Re: Strange rotation

hate to keep asking for stuff but i just havent gotten around to downloading and installing physx.  in your above code can you show the debug output of ePitch, eYaw, and eRoll?  im curious as to what these values are when the rotation goes whacky.

Re: Strange rotation

ok ive downloaded and installed physx.  is it possible to get the source to your physx_func.bmx file?

Re: Strange rotation

Okay thanks gman, here you go.

' PhysX wrapper functions
' For BlitzMax
' Author - Render


Extern "win32"
 Function FindWindowA:Int(class:Int,title$z)
 Function LoadLibraryA(lib$z)
 Function GetProcAddress:Byte Ptr(lib%,fname$z)
End Extern


Global pxBodyCreatePlane%(x#, y#, z#) "win32"
Global pxBodyCreateCube%(dx#, dy#, dz#, mass#) "win32"
Global pxBodyCreateSphere%(radius#, mass#) "win32"
Global pxBodyCreateCapsule%(height#, radius#, mass#) "win32"
Global pxBodyCreateCylinder%(radius#, height#, nbEdge%, mass#) "win32"
Global pxBodyCreateHull%(vbank:Byte Ptr, nvert%,mass#) "win32"
Global pxBodyCreateHullFromSSM%(surf%, mass#) "win32"
  
Global pxCreateTriMeshPmap%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%, file_name:Byte Ptr, pMap%) "win32"
Global pxCreateTriMeshFromPmap%(triangleMesh%, mass#) "win32"
Global pxCreateTriMesh%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%, mass#) "win32"
Global pxCreateTerrain%(nSize%, bank:Byte Ptr, scale_x#, scale_y#, scale_z#) "win32"
Global pxCreateTerrainFromMesh%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%, axis#) "win32"
Global pxCreateTerrainPmap(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%, axis#, file_name:Byte Ptr, pMap%) "win32"
Global pxTestTriMesh%(entity%, mass#) "win32"
Global pxCreateTriMeshToFile%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%, fname:Byte Ptr) "win32"
Global pxCreateTriMeshFromFile%(fname:Byte Ptr, mass#) "win32"
  
  
  
Global pxParticleCreateEmitter%() "win32"
Global pxParticleEmitSetAngDamping(pEmitter, damp) "win32"
Global pxParticleEmitSetLinDamping(pEmitter, damp) "win32"
Global pxParticleEmitSetMass(pEmitter%, mass#) "win32"
Global pxParticleEmitSetRadius(pEmitter%, radius#) "win32"
Global pxParticleEmitSetPosition(pEmitter%, x#, y#, z#) "win32"
Global pxParticleEmitSetRotation(pEmitter%, pitch#, yaw#, roll#) "win32"
Global pxParticleEmitSetRandRadius(pEmitter%, radius#) "win32"
Global pxParticleEmitSetStartSpeed(pEmitter%, minv#, maxv#) "win32"
Global pxParticleEmitSetTDAcceleration(pEmitter%, x#, y#, z#) "win32"
Global pxParticleEmitSetScaleFactor(pEmitter%, radius#, rate#) "win32"
Global pxParticleEmitDeleteFirstParticle%(pEmitter%) "win32"
Global pxParticleEmitDeleteParticle(pEmitter%, particle%) "win32"
  
Global pxParticleEmitGetAngDamping#(pEmitter%) "win32"
Global pxParticleEmitGetLinDamping#(pEmitter%) "win32"
Global pxParticleEmitGetMass#(pEmitter%) "win32"
Global pxParticleEmitGetRadius#(pEmitter%) "win32"
Global pxParticleEmitGetPositionX#(pEmitter%) "win32"
Global pxParticleEmitGetPositionY#(pEmitter%) "win32"
Global pxParticleEmitGetPositionZ#(pEmitter%) "win32"
Global pxParticleEmitGetRotationPitch#(pEmitter%) "win32"
Global pxParticleEmitGetRotationYaw#(pEmitter%) "win32"
Global pxParticleEmitGetRotationRoll#(pEmitter%) "win32"
Global pxParticleEmitGetRandRadius#(pEmitter%) "win32"
Global pxParticleEmitGetStartSpeedMax#(pEmitter%) "win32"
Global pxParticleEmitGetStartSpeedMin#(pEmitter%) "win32"
Global pxParticleEmitGetTDAccelerationX#(pEmitter%) "win32"
Global pxParticleEmitGetTDAccelerationY#(pEmitter%) "win32"
Global pxParticleEmitGetTDAccelerationZ#(pEmitter%) "win32"
Global pxParticleEmitGetScaleFactorRadius#(pEmitter%) "win32"
Global pxParticleEmitGetScaleFactorRate#(pEmitter%) "win32"
Global pxParticleEmitGetNumberParticles%(pEmitter%) "win32"
  
Global pxParticleEmitAddParticle%(pEmitter%, entity%) "win32"
Global pxParticleEmitDelete(pEmitter%) "win32"
Global pxParticleUpdateEmitter(pEmitter%) "win32"
Global pxParticleGetEntity%(particle%) "win32"
Global pxParticleGetBody%(particle%) "win32"
Global pxParticleGetradius#(particle%) "win32"
  
  
Global pxKinematicSet(body%) "win32"
Global pxKinematicClear(body%) "win32"
Global pxKinematicMove(body%, x#, y#, z#) "win32"
Global pxKinematicSetPosition(body%, x#, y#, z#) "win32"
Global pxKinematicSetRotation(body%, pitch#, yaw#, roll#) "win32"
  
  
Global pxCreateMagnet%(minvforce#, middleforce#, maxforce#) "win32"
Global pxMagnetActivate(mdata%, mmode%, fmode%) "win32"
Global pxMagnetSetPosition(mdata%, pos_x#, pos_y#, pos_z#) "win32"
Global pxMagnetSetMaxRadius(mdata%, radius#) "win32"
Global pxMagnetSetMinRadius(mdata%, radius#) "win32"
Global pxMagnetSetMaxForce(mdata%, force#) "win32"
Global pxMagnetSetMidForce(mdata%, force#) "win32"
Global pxMagnetSetMinForce(mdata%, force#) "win32"
Global pxMagnetSetMask(mdata%, mask%) "win32"
Global pxMagnetGetPositionX#(mdata) "win32"
Global pxMagnetGetPositionY#(mdata) "win32"
Global pxMagnetGetPositionZ#(mdata) "win32"
Global pxMagnetGetMaxRadius#(mdata%) "win32"
Global pxMagnetGetMinRadius#(mdata%) "win32"
Global pxMagnetGetMaxForce#(mdata%) "win32"
Global pxMagnetGetMidForce#(mdata%) "win32"
Global pxMagnetGetMinForce#(mdata%) "win32"
Global pxMagnetGetMask%(mdata%) "win32"
Global pxMagnetDelete(mdata%) "win32"
  
  
Global pxCreateWaterCirPlane%(radius#, depth#) "win32"
Global pxCreateWaterRectPlane%(width#, height#, depth#) "win32"
Global pxCreateWaterInfinPlane%(depth#) "win32"
Global pxWaterSetDimension(water%, width#, height#) "win32"
Global pxWaterSetRadius(water%, radius#) "win32"
Global pxWaterSetPosition(water%, pos_x#, pos_y#, pos_z#) "win32"
Global pxWaterSetRotation(water%, angle#) "win32"
Global pxWaterSetFluxion(water%, fl_x#, fl_y#, fl_z#) "win32"
Global pxWaterGetWidth#(water%) "win32"
Global pxWaterGetHeight#(water%) "win32"
Global pxWaterGetRadius#(water%) "win32"
Global pxWaterGetPositionX#(water%) "win32"
Global pxWaterGetPositionY#(water%) "win32"
Global pxWaterGetPositionZ#(water%) "win32"
Global pxWaterGetRotation#(water%) "win32"
Global pxWaterGetDepth#(water%) "win32"
Global pxWaterDelete(water%) "win32"
  
Global pxCreateKep%(buo#, radius#, maxvdis#) "win32"
Global pxKepAddToBody(kdata%, body%) "win32"
Global pxKepSetLocalPosition(kdata%, pos_x#, pos_y#, pos_z#) "win32"
Global pxKepSetGlobalPosition(kdata%, pos_x#, pos_y#, pos_z#) "win32"
Global pxKepSetAngularDamping(kdata%, angdamp#) "win32"
Global pxKepSetLinearDamping(kdata%, lindamp#) "win32"
Global pxWaterUpdate(water%) "win32"
Global pxKepGetPosX#(kdata%) "win32"
Global pxKepGetPosY#(kdata%) "win32"
Global pxKepGetPosZ#(kdata%) "win32"
Global pxKepGetNumber%(body%) "win32"
Global pxKepGetKepFromBody%(body%, num%) "win32"
  
  
Global pxTriggerCreateCube%(dx#, dy#, dz#) "win32"
Global pxTriggerCreateSphere%(radius#) "win32"
Global pxTriggerCreateCapsule%(height#, radius#) "win32"
Global pxTriggerCreateCylinder%(radius#, height#, nbEdge%) "win32"
Global pxTriggerCreateHull%(vbank:Byte Ptr, nvert%) "win32"
Global pxTriggerSetPosition(body%, x#, y#, z#) "win32"
Global pxTriggerSetRotation(body%, pitch#, yaw#, roll#) "win32"
Global pxTriggerGetNumBody%(trigger%) "win32"
Global pxTriggerGetBody%(trigger%, num%) "win32"
Global pxTriggerGetBodyTrigger%(body%) "win32"
Global pxUpdateTriggers() "win32"
  
  
Global pxCreateCompoundDesc%() "win32"
Global pxCompoundAddCubeShape%(compoundDesc%, dx#, dy#, dz#) "win32"
Global pxCompoundAddSphereShape%(compoundDesc%, radius#) "win32"
Global pxCompoundAddCapsuleShape%(compoundDesc%, radius#, height#) "win32"
Global pxCompoundAddCylinderShape%(compoundDesc%, radius#, height#, nbEdge%) "win32"
Global pxCompoundAddHullShape%(compoundDesc%, vbank:Byte Ptr, nvert%) "win32"
Global pxCompoundSetShapePos(shape%, x#, y#, z#) "win32"
Global pxCompoundSetShapeRot(shape%, pitch#, yaw#, roll#) "win32"
Global pxCreateCompound%(compoundDesc%, mass#) "win32"
Global pxCreateStaticCompound%(compoundDesc%, mass#) "win32"
  
  
Global pxCreateCloth%(entity%, surf%) "win32"
Global pxCreateTearableCloth%(entity%, surf%) "win32"
Global pxCreateMetalCloth%(entity%, surf%, coreActor%, impThr#, depth#) "win32"
Global pxCreateClothSpec%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%, MESH_NBFACES%) "win32"
Global pxCreateMetalClothSpec%(vbank:Byte Ptr, fbank:Byte Ptr, MESH_NBVERTICES%,MESH_NBFACES%, coreActor%, impThr#, depth#) "win32"
  
Global pxClothGetAttachmentResponseCoefficient#(Cloth%) "win32"
Global pxClothGetAttachmentTearFactor#(Cloth%) "win32"
Global pxClothGetBendingStiffness#(Cloth%) "win32"
Global pxClothGetCollisionResponseCoefficient#(Cloth%) "win32"
Global pxClothGetDampingCoefficient#(Cloth%) "win32"
Global pxClothGetDensity#(Cloth%) "win32"
Global pxClothGetFriction#(Cloth%) "win32"
Global pxClothGetPressure#(Cloth%) "win32"
Global pxClothGetSleepLinearVelocity#(Cloth%) "win32"
Global pxClothGetStretchingStiffness#(Cloth%) "win32"
Global pxClothGetTearFactor#(Cloth%) "win32"
Global pxClothGetThickness#(Cloth%) "win32"
Global pxClothGetNumVertices%(Cloth%) "win32"
Global pxClothIsSleeping%(Cloth%) "win32"
Global pxClothGetEntity%(Cloth%) "win32"
Global pxClothGetUserData%(Cloth%) "win32"
Global pxClothPutToSleep(Cloth%) "win32"
Global pxClothWakeUp(Cloth%) "win32"
  
Global pxClothSetTeareble(Cloth%) "win32"
Global pxClothSetTearFactor(Cloth%, coef#) "win32"
  
Global pxClothSetAttachmentResponseCoefficient#(Cloth%, coef#) "win32"
Global pxClothSetAttachmentTearFactor#(Cloth%, coef#) "win32"
Global pxClothSetBending(Cloth%) "win32"
Global pxClothSetBendingStiffness#(Cloth%, coef#) "win32"
Global pxClothSetCollisionResponseCoefficient#(Cloth%, coef#) "win32"
Global pxClothSetDampingCoefficient#(Cloth%, coef#) "win32"
Global pxClothSetComDampingCoefficient#(Cloth%, coef#) "win32"
Global pxClothSetFriction#(Cloth%, coef#) "win32"
Global pxClothSetPressure#(Cloth%, coef#) "win32"
Global pxClothSetSleepLinearVelocity#(Cloth%, coef#) "win32"
Global pxClothSetStretchingStiffness#(Cloth%, coef#) "win32"
Global pxClothSetThickness#(Cloth%, coef#) "win32"
Global pxClothSetUserData(Cloth%, userdata%) "win32"
Global pxClothMaskSet(Cloth%, mask%) "win32"
Global pxClothMaskCombineSet(Cloth%, mask%) "win32"
  
Global pxClothSetVertexPos(Cloth%, vbank:Byte Ptr, numVert%) "win32"
Global pxClothGetVertexPos(Cloth%, vbank:Byte Ptr, numVert%) "win32"
Global pxClothGetNormals(Cloth%, nbank:Byte Ptr) "win32"
  
Global pxClothAttachVertexToPos(Cloth%, vID%, pos_x#, pos_y#, pos_z#) "win32"
Global pxClothAttachToCollidingShapes(Cloth%) "win32"
Global pxClothAddForceAtPos(Cloth%, pos_x#, pos_y#, pos_z#, magnitude#, radius#) "win32"
Global pxClothAddForceAtVertex(Cloth%, nx#, ny#, nz#, vID%) "win32"
Global pxUpdateCloth() "win32"
Global pxClothDelete(Cloth%) "win32"
  
  
Global pxCreateSpringAndDamperEffector%(body1%, body2%) "win32"
Global pxSetLinearSpring(spring%, SpringRelaxed#, CompressForce#, CompressSaturate#, StretchForce#, StretchSaturate#) "win32"
Global pxSetLinearDamper(spring%, CompressForce#, CompressSaturate#, StretchForce#, StretchSaturate#) "win32"
Global pxDeleteEffector(effector%) "win32"
  
  
Global pxWheelAddToBody%(body%, pos_x#, pos_y#, pos_z#) "win32"
Global pxWheelSetRadius(wheel%, radius#) "win32"
Global pxWheelSetRotation(wheel%, pitch#, yaw#, roll#) "win32"
Global pxWheelSetMotorTorque(wheel%, torque#) "win32"
Global pxWheelSetSteerAngle(wheel%, angle#) "win32"
Global pxWheelSetBrakeTorque(wheel%, torque#) "win32"
Global pxWheelSetSuspension(wheel%, susp#, rest#, damping#) "win32"
Global pxWheelSetFrictionToSide(wheel%, friction#) "win32"
Global pxWheelSetFrictionToFront(wheel%, friction#) "win32"
Global pxWheelSetCollisionGroup(wheel%, group%) "win32"
  
Global pxWheelGetSteerAngle#(wheel%) "win32"
Global pxWheelGetAxleSpeed#(wheel%) "win32"
Global pxWheelGetRadius#(wheel%) "win32"
Global pxWheelGetSuspensionTravel#(wheel%) "win32"
Global pxWheelGetSuspensionRestitution#(wheel%) "win32"
Global pxWheelGetSuspensionDamping#(wheel%) "win32"
  
Global pxWheelGetPositionX#(wheel%) "win32"
Global pxWheelGetPositionY#(wheel%) "win32"
Global pxWheelGetPositionZ#(wheel%) "win32"
Global pxWheelUpdateSpec(wheel%, mode%) "win32"
Global pxWheelGetPositionXSpec#(wheel%) "win32"
Global pxWheelGetPositionYSpec#(wheel%) "win32"
Global pxWheelGetPositionZSpec#(wheel%) "win32"
Global pxWheelGetRotationPitchSpec#(wheel%) "win32"
Global pxWheelGetRotationYawSpec#(wheel%) "win32"
Global pxWheelGetRotationRollSpec#(wheel%) "win32"
  
Global pxWheelGetContactX#(wheel%) "win32"
Global pxWheelGetContactY#(wheel%) "win32"
Global pxWheelGetContactZ#(wheel%) "win32"
Global pxWheelGetContactForce#(wheel%) "win32"
Global pxWheelGetContactLatDirectionX#(wheel%) "win32"
Global pxWheelGetContactLatDirectionY#(wheel%) "win32"
Global pxWheelGetContactLatDirectionZ#(wheel%) "win32"
Global pxWheelGetContactLatImpulse#(wheel%) "win32"
Global pxWheelGetContactLonDirectionX#(wheel%) "win32"
Global pxWheelGetContactLonDirectionY#(wheel%) "win32"
Global pxWheelGetContactLonDirectionZ#(wheel%) "win32"
Global pxWheelGetContactLonImpulse#(wheel%) "win32"
Global pxWheelGetContactMaterial%(wheel%) "win32"
Global pxWheelGetFrictionToSide#(wheel%) "win32"
Global pxWheelGetFrictionToFront#(wheel%) "win32"
  
Global pxWheelSetMask(wheel%, mask%) "win32"
Global pxWheelSetMaskCombine(wheel%, mask%) "win32"
Global pxWheelClearMask(wheel%) "win32"
Global pxWheelDelete(wheel%) "win32"
  
  
Global pxJointCreateSuspFront%(body0%, body1%, x#, y#, z#) "win32"
Global pxJointCreateSuspBack%(body0%, body1%, x#, y#, z#) "win32"
Global pxJointSuspSetSteerN(joint%, x#, y#, z#) "win32"
Global pxJointSuspSetTurnN(joint%, x#, y#, z#) "win32"
Global pxJointSuspSetLinLimit(joint%, lim#) "win32"
Global pxJointSuspSetLinParameter(joint%, spring#, rest#, damp#) "win32"
Global pxJointSuspSetAngLimit(joint%, lim#) "win32"
Global pxJointSuspSetAngParameter(joint%, spring#, rest#, damp#) "win32"
Global pxJointSuspSetAngle(joint%, angle#) "win32"
Global pxJointSuspSetSpeed(joint%, speed#) "win32"
Global pxJointSuspSetBrake(joint%, mode%) "win32"
  
  
Global pxCCDSkeletonEnable(mode%) "win32"
Global pxCCDSkeletonSetEpsilon(eps#) "win32"
Global pxBodySetCCDSkeleton(body%, x#, y#, z#) "win32"
Global pxBodySetCCDSkeletonThreshold(body%, thres#) "win32"
Global pxBodySetFlagCCDSkeletonDynamic(body%) "win32"
Global pxBodyGetCCDSkeleton%(body%) "win32"
Global pxBodyDeleteCCDSkeleton(ccd%) "win32"
  
  
Global pxCreateRay%() "win32"
Global pxRaySetDir(ray%, nx#, ny#, nz#) "win32"
Global pxRaySetPosition(ray%, x#, y#, z#) "win32"
Global pxRayGetDistance#(ray%, mode%) "win32"
Global pxRayGetBody%(ray%, mode%) "win32"
Global pxRayGetMaterial%(ray%, mode%) "win32"
Global pxRayGetPickX#(ray%, mode%) "win32"
Global pxRayGetPickY#(ray%, mode%) "win32"
Global pxRayGetPickZ#(ray%, mode%) "win32"
Global pxRayGetPickNX#(ray%, mode%) "win32"
Global pxRayGetPickNY#(ray%, mode%) "win32"
Global pxRayGetPickNZ#(ray%, mode%) "win32"
  
  
Global pxRegWriteDriverPath%(str:Byte Ptr) "win32"
Global pxRegWriteString%(RootKey%, Path:Byte Ptr, Name:Byte Ptr, Data:Byte Ptr) "win32"
Global pxRegWriteInt%(RootKey%, Path:Byte Ptr, Name:Byte Ptr, Data%) "win32"
Global pxRegReadInt%(RootKey%, Path:Byte Ptr, Name:Byte Ptr) "win32"
Global pxRegReadString:Byte Ptr(RootKey%, Path:Byte Ptr, Name:Byte Ptr) "win32"
Global pxRegDeleteValue%(RootKey%, Path:Byte Ptr, Name:Byte Ptr) "win32"
Global pxRegDeleteKey%(RootKey%, Path:Byte Ptr, Name:Byte Ptr) "win32"
  
  
Global pxGetContacts%(body%) "win32"
Global pxContactGetBody%(body%, coll%) "win32"
Global pxContactGetPointX#(body%, coll%) "win32"
Global pxContactGetPointY#(body%, coll%) "win32"
Global pxContactGetPointZ#(body%, coll%) "win32"
Global pxContactGetPointNX#(body%, coll%) "win32"
Global pxContactGetPointNY#(body%, coll%) "win32"
Global pxContactGetPointNZ#(body%, coll%) "win32"
Global pxContactGetForceN#(body%, coll%) "win32"
Global pxContactGetForceNX#(body%, coll%) "win32"
Global pxContactGetForceNY#(body%, coll%) "win32"
Global pxContactGetForceNZ#(body%, coll%) "win32"
Global pxContactGetForceT#(body%, coll%) "win32"
Global pxContactGetForceTX#(body%, coll%) "win32"
Global pxContactGetForceTY#(body%, coll%) "win32"
Global pxContactGetForceTZ#(body%, coll%) "win32"
Global pxContactEventsOnStartTouch%(body%) "win32"
Global pxContactEventsOnEndTouch%(body%) "win32"
  
  
Global pxMaskSet(body%, mask%) "win32"
Global pxMaskCombineSet(body%, mask%) "win32"
Global pxMaskClear(body%) "win32"
Global pxBodySetCollisionGroup(body%, group%) "win32"
Global pxBodySetCollisionGroupPair(group1%, group2%) "win32"
Global pxBodySetCollisionGroupFlag(group1%, group2%, flag%) "win32"
Global pxBodySetMagnetMask(body%, mask%) "win32"
Global pxBodyGetMagnetMask%(body%) "win32"
  
  
Global pxBodySetFrozen(body%, stat%) "win32"
Global pxBodySetFrozenRotX(body%, stat%) "win32"
Global pxBodySetFrozenRotY(body%, stat%) "win32"
Global pxBodySetFrozenRotZ(body%, stat%) "win32"
Global pxBodySetFrozenRot(body%, stat%) "win32"
Global pxBodySetFrozenPosX(body%, stat%) "win32"
Global pxBodySetFrozenPosY(body%, stat%) "win32"
Global pxBodySetFrozenPosZ(body%, stat%) "win32"
Global pxBodySetFrozenPos(body%, stat%) "win32"
Global pxBodySetFlagGravity(body%, stat%) "win32"
Global pxBodySetFlagCollision(body%, stat%) "win32"
Global pxBodySetFlagResponse(body%, stat%) "win32"
Global pxBodySetFlagContacttable(body%, stat%) "win32"
Global pxBodySetFlagMagniteble(body%, stat%) "win32"
Global pxBodySetFlagTriggertable(body%, stat%) "win32"
Global pxBodySetFlagRayCast(body%, stat%) "win32"
  
  
Global pxDeleteBody(num%) "win32"
Global pxDeleteJoint(joint%) "win32"
  
  
Global pxJointCreateHinge%(body1%, body2%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxJointCreateSpherical%(body1%, body2%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxJointCreateDistance%(body1%, body2%, p1_x#, p1_y#, p1_z#, p2_x#, p2_y#, p2_z#) "win32"
Global pxJointCreateFixed%(body1%, body2%) "win32"
Global pxJointCreateCylindrical%(body1%, body2%, x#, y#, z#, nx#, ny#, nz#, minv_limit#, maxv_limit#) "win32"
Global pxJointCreatePrismatic%(body1%, body2%, x#, y#, z#, nx#, ny#, nz#, minv_limit#, maxv_limit#) "win32"
Global pxJointCreateOnLine%(body1%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxJointCreateInPlane%(body1%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxJointCreatePulley%(body1%, body2%, distance#, stiff#, k_ratio#) "win32"
  
Global pxJointCreateD6Joint%(body1%, body2%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxD6JointSetPosMotion(joint%, xMot%, yMot%, zMot%) "win32"
Global pxD6JointSetAngleMotion(joint%, twistMot%, swing1Mot%, swing2Mot%) "win32"
Global pxD6JointSetLinearLimit(joint%, lim#) "win32"
Global pxD6JointSetSwingLimit(joint%, swing1Lim#, swing2Lim#) "win32"
Global pxD6JointSetTwistLimit(joint%, lowLim#, heighLim#) "win32"
  
Global pxJointHingeSetLimit(joint%, minv#, maxv#) "win32"
Global pxJointHingeSetSpring(joint%, spr#, targetVal#) "win32"
Global pxJointSphericalSetLimitAngle(joint%, angle#, hardn#, restit#) "win32"
Global pxJointSphericalSetLimitTwist(joint%, minvtwist#, maxvtwist#, spr#, damp#, targetVal#) "win32"
Global pxJointSphericalSetLimitSpring(joint%, spr#, damp#, targetVal#) "win32"
Global pxJointDistanceSetPoint(joint%, minvdist#, maxvdist#) "win32"
Global pxJointDistanceSetSpring(joint%, spr#, damp#) "win32"
Global pxJointAddLimitPlane(joint%, x#, y#, z#, nx#, ny#, nz#) "win32"
Global pxJointPulleySetAnchor(joint%, x1#, y1#, z1#, x2#, y2#, z2#) "win32"
Global pxJointPulleySetLocalAttachBody(joint%, x1#, y1#, z1#, x2#, y2#, z2#) "win32"
Global pxJointHingeSetMotor(joint%, force#, velTarget#) "win32"
Global pxJointSetBreakable(joint%, force#, torque#) "win32"
Global pxJointIsBroken%(joint%) "win32"
Global pxJointHingeSetCollision(joint%) "win32"
Global pxJointSphericalSetCollision(joint%) "win32"
Global pxJointDistanceSetCollision(joint%) "win32"
Global pxJointCylindricalSetCollision(joint%) "win32"
  
  
Global pxSetGravity(gx#, gy#, gz#) "win32"
Global pxBodySetMass(num%, mass#) "win32"
Global pxBodySetCMassLocalPosition(num%, x#, y#, z#) "win32"
Global pxBodySetCMassGlobalPosition(num%, x#, y#, z#) "win32"
Global pxBodySetMassSpaceInertiaTensor(num%, x#, y#, z#) "win32"
Global pxBodyGetCMassGlobalPositionX#(body%) "win32"
Global pxBodyGetCMassGlobalPositionY#(body%) "win32"
Global pxBodyGetCMassGlobalPositionZ#(body%) "win32"
Global pxBodyGetCMassLocalPositionX#(body%) "win32"
Global pxBodyGetCMassLocalPositionY#(body%) "win32"
Global pxBodyGetCMassLocalPositionZ#(body%) "win32"
Global pxBodyGetMass#(body%) "win32"
  
  
Global pxBodySetMyForce(body%, lx#, ly#, lz#) "win32"
Global pxBodyAddForce(num%, vx#, vy#, vz#, mode%) "win32"
Global pxBodyAddForceAtPos(num%, vx#, vy#, vz#, px#, py#, pz#, mode%) "win32"
Global pxBodyAddForceAtLocalPos(body%, vx#, vy#, vz#, px#, py#, pz#, mode%) "win32"
Global pxBodyAddLocalForce(num%, vx#, vy#, vz#, mode%) "win32"
Global pxBodyAddLocalForceAtPos(num%, vx#, vy#, vz#, px#, py#, pz#, mode%) "win32"
Global pxBodyAddLocalForceAtLocalPos(body%, vx#, vy#, vz#, px#, py#, pz#, mode%) "win32"
  
Global pxBodyAddTorque(body%, vx#, vy#, vz#, mode%) "win32"
Global pxBodyAddLocalTorque(body%, vx#, vy#, vz#, mode%) "win32"
Global pxBodySetAngularSpeed(body%, ax#, ay#, az#) "win32"
Global pxBodySetLinearSpeed(body%, lx#, ly#, lz#) "win32"
Global pxBodySetLocalLinearSpeed(body%, lx#, ly#, lz#) "win32"
Global pxBodySetLocalAngularSpeed(body%, lx#, ly#, lz#) "win32"
Global pxBodySetAngularDamping(body%, angDamp#) "win32"
Global pxBodySetLinearDamping(body%, linDamp#) "win32"
Global pxBodySetAngularMomentum(body%, ax#, ay#, az#) "win32"
Global pxBodySetLinearMomentum(body%, lx#, ly#, lz#) "win32"
Global pxBodySetMaxAngularSpeed(body%, speed#) "win32"
Global pxBodySetSleepEnergyThreshold(body%, tres#) "win32"
Global pxBodySetSleepAngularVelocity(body%, tres#) "win32"
Global pxBodySetSleepLinearVelocity(body%, tres#) "win32"
Global pxBodySetSleepWakeUp(body%, wakeCounterValue#) "win32"
Global pxBodySetSleepPut(body%) "win32"
Global pxBodySetSolverIterationCount(body%, itercount%) "win32"
Global pxBodySetBodyName(body%, name:Byte Ptr) "win32"
Global pxBodySetBodyEntity(body%, entity%) "win32"
Global pxBodySetBodyUserData(body%, userdata%) "win32"
Global pxMoveBodyToPoint(body%, maxvspeed#, x#, y#, z#) "win32"
Global pxAddBodytoBody(body1%, body2%) "win32"
Global pxCopyBody%(body%) "win32"
  
  
Global pxCreateMaterial%() "win32"
Global pxMaterialSetToBody(body%, mat%) "win32"
Global pxMaterialSetRestitution(mat%, rest#) "win32"
Global pxMaterialSetRestitutionCombineMode(mat%, mode%) "win32"
Global pxMaterialSetStFriction(mat%, fric#) "win32"
Global pxMaterialSetDyFriction(mat%, fric#) "win32"
Global pxMaterialSetFrictionV(mat%, sfric#, dfric#) "win32"
Global pxMaterialSetFrictionCombineMode(mat%, mode%) "win32"
Global pxCreateAnisotripicMaterial%(nx#, ny#, nz#) "win32"
Global pxMaterialSetFlagStrongFriction(mat%) "win32"
Global pxGetMaterial%(body%) "win32"
  
  
Global pxBodySetPosition(num%, pos_x#, pos_y#, pos_z#) "win32"
Global pxBodySetRotation(num%, pitch#, yaw#, roll#) "win32"
  
Global pxBodyGetPositionX#(num%) "win32"
Global pxBodyGetPositionY#(num%) "win32"
Global pxBodyGetPositionZ#(num%) "win32"
Global pxBodyGetRotationPitch#(num%) "win32"
Global pxBodyGetRotationYaw#(num%) "win32"
Global pxBodyGetRotationRoll#(num%) "win32"
Global pxBodyGetAngularSpeed#(num%) "win32"
Global pxBodyGetAngularSpeedX#(num%) "win32"
Global pxBodyGetAngularSpeedY#(num%) "win32"
Global pxBodyGetAngularSpeedZ#(num%) "win32"
Global pxBodyGetLinearSpeed#(num%) "win32"
Global pxBodyGetLinearSpeedX#(num%) "win32"
Global pxBodyGetLinearSpeedY#(num%) "win32"
Global pxBodyGetLinearSpeedZ#(num%) "win32"
Global pxBodyGetLocalLinearSpeedX#(body%) "win32"
Global pxBodyGetLocalLinearSpeedY#(body%) "win32"
Global pxBodyGetLocalLinearSpeedZ#(body%) "win32"
Global pxBodyGetLinearVecSpeedX#(num%) "win32"
Global pxBodyGetLinearVecSpeedY#(num%) "win32"
Global pxBodyGetLinearVecSpeedZ#(num%) "win32"
Global pxBodyGetLocalPointSpeed(body%, x#, y#, z#) "win32"
Global pxBodyGetLocalPointSpeedX(body%, x#, y#, z#) "win32"
Global pxBodyGetLocalPointSpeedY(body%, x#, y#, z#) "win32"
Global pxBodyGetLocalPointSpeedZ(body%, x#, y#, z#) "win32"
  
  
Global pxBodyGetAngularDamping#(body%) "win32"
Global pxBodyGetLinearDamping#(body%) "win32"
Global pxBodyGetAngularMomentum#(body%) "win32"
Global pxBodyGetLinearMomentum#(body%) "win32"
Global pxBodyGetMaxAngularVelocity#(body%) "win32"
Global pxGetBodyName:Byte Ptr(body%) "win32"
Global pxGetBodyEntity%(body%) "win32"
Global pxGetBodyUserData%(body%) "win32"
Global pxBodyGetSleepAngularVelocity#(body%) "win32"
Global pxBodyGetSleepLinearVelocity#(body%) "win32"
Global pxBodyIsDynamic%(body%) "win32"
Global pxBodyIsSleeping%(body%) "win32"
  
  
Global pxGetNumberAllBody%() "win32"
Global pxCreateWorld%(plane%, password:Byte Ptr) "win32"
Global pxDestroyWorld() "win32"
Global pxRenderPhysic(time#, sinc%) "win32"
Global pxSetTiming(maxTimeStep#, maxIter%, StepMethod%) "win32"
Global pxSDKSetParameter(param#) "win32"
Global pxSetPause(pause%) "win32"
Global pxChekPPU%() "win32"
Global pxChekPPUMode%() "win32"
Global pxSetHardwareSimulation(mode%) "win32"
  
Global pxCreateScene%() "win32"
Global pxSceneChange(scene) "win32"
  
  
Global pxBodyAddEntity(entity%,body%) "win32"
  
Global peeksint%(addr%) "win32"
  
Global pxGetAngleBetweenVec#(v1x#, v1y#, v1z#, v2x#, v2y#, v2z#) "win32"



Global lib% = LoadLibraryA("Blitzpx.dll")
If lib%

pxBodyCreatePlane=GetProcAddress(lib,"_pxBodyCreatePlane@12")
pxBodyCreateCube=GetProcAddress(lib,"_pxBodyCreateCube@16")
pxBodyCreateSphere=GetProcAddress(lib,"_pxBodyCreateSphere@8")
pxBodyCreateCapsule=GetProcAddress(lib,"_pxBodyCreateCapsule@12")
pxBodyCreateCylinder=GetProcAddress(lib,"_pxBodyCreateCylinder@16")
pxBodyCreateHull=GetProcAddress(lib,"_pxBodyCreateHull@12")
pxBodyCreateHullFromSSM=GetProcAddress(lib,"_pxBodyCreateHullFromSSM@8")
 
pxCreateTriMeshPmap=GetProcAddress(lib,"_pxCreateTriMeshPmap@24")
pxCreateTriMeshFromPmap=GetProcAddress(lib,"_pxCreateTriMeshFromPmap@8")
pxCreateTriMesh=GetProcAddress(lib,"_pxCreateTriMesh@20")
pxCreateTerrain=GetProcAddress(lib,"_pxCreateTerrain@20")
pxCreateTerrainFromMesh=GetProcAddress(lib,"_pxCreateTerrainFromMesh@20")
pxCreateTerrainPmap=GetProcAddress(lib,"_pxCreateTerrainPmap@28")
pxTestTriMesh=GetProcAddress(lib,"_pxTestTriMesh@8")
pxCreateTriMeshToFile=GetProcAddress(lib,"_pxCreateTriMeshToFile@20")
pxCreateTriMeshFromFile=GetProcAddress(lib,"_pxCreateTriMeshFromFile@8")
 
 
 
pxParticleCreateEmitter=GetProcAddress(lib,"_pxParticleCreateEmitter@0")
pxParticleEmitSetAngDamping=GetProcAddress(lib,"_pxParticleEmitSetAngDamping@8")
pxParticleEmitSetLinDamping=GetProcAddress(lib,"_pxParticleEmitSetLinDamping@8")
pxParticleEmitSetMass=GetProcAddress(lib,"_pxParticleEmitSetMass@8")
pxParticleEmitSetRadius=GetProcAddress(lib,"_pxParticleEmitSetRadius@8")
pxParticleEmitSetPosition=GetProcAddress(lib,"_pxParticleEmitSetPosition@16")
pxParticleEmitSetRotation=GetProcAddress(lib,"_pxParticleEmitSetRotation@16")
pxParticleEmitSetRandRadius=GetProcAddress(lib,"_pxParticleEmitSetRandRadius@8")
pxParticleEmitSetStartSpeed=GetProcAddress(lib,"_pxParticleEmitSetStartSpeed@12")
pxParticleEmitSetTDAcceleration=GetProcAddress(lib,"_pxParticleEmitSetTDAcceleration@16")
pxParticleEmitSetScaleFactor=GetProcAddress(lib,"_pxParticleEmitSetScaleFactor@12")
pxParticleEmitDeleteFirstParticle=GetProcAddress(lib,"_pxParticleEmitDeleteFirstParticle@4")
pxParticleEmitDeleteParticle=GetProcAddress(lib,"_pxParticleEmitDeleteParticle@8")
 
pxParticleEmitGetAngDamping=GetProcAddress(lib,"_pxParticleEmitGetAngDamping@4")
pxParticleEmitGetLinDamping=GetProcAddress(lib,"_pxParticleEmitGetLinDamping@4")
pxParticleEmitGetMass=GetProcAddress(lib,"_pxParticleEmitGetMass@4")
pxParticleEmitGetRadius=GetProcAddress(lib,"_pxParticleEmitGetRadius@4")
pxParticleEmitGetPositionX=GetProcAddress(lib,"_pxParticleEmitGetPositionX@4")
pxParticleEmitGetPositionY=GetProcAddress(lib,"_pxParticleEmitGetPositionY@4")
pxParticleEmitGetPositionZ=GetProcAddress(lib,"_pxParticleEmitGetPositionZ@4")
pxParticleEmitGetRotationPitch=GetProcAddress(lib,"_pxParticleEmitGetRotationPitch@4")
pxParticleEmitGetRotationYaw=GetProcAddress(lib,"_pxParticleEmitGetRotationYaw@4")
pxParticleEmitGetRotationRoll=GetProcAddress(lib,"_pxParticleEmitGetRotationRoll@4")
pxParticleEmitGetRandRadius=GetProcAddress(lib,"_pxParticleEmitGetRandRadius@4")
pxParticleEmitGetStartSpeedMax=GetProcAddress(lib,"_pxParticleEmitGetStartSpeedMax@4")
pxParticleEmitGetStartSpeedMin=GetProcAddress(lib,"_pxParticleEmitGetStartSpeedMin@4")
pxParticleEmitGetTDAccelerationX=GetProcAddress(lib,"_pxParticleEmitGetTDAccelerationX@4")
pxParticleEmitGetTDAccelerationY=GetProcAddress(lib,"_pxParticleEmitGetTDAccelerationY@4")
pxParticleEmitGetTDAccelerationZ=GetProcAddress(lib,"_pxParticleEmitGetTDAccelerationZ@4")
pxParticleEmitGetScaleFactorRadius=GetProcAddress(lib,"_pxParticleEmitGetScaleFactorRadius@4")
pxParticleEmitGetScaleFactorRate=GetProcAddress(lib,"_pxParticleEmitGetScaleFactorRate@4")
pxParticleEmitGetNumberParticles=GetProcAddress(lib,"_pxParticleEmitGetNumberParticles@4")
 
pxParticleEmitAddParticle=GetProcAddress(lib,"_pxParticleEmitAddParticle@8")
pxParticleEmitDelete=GetProcAddress(lib,"_pxParticleEmitDelete@4")
pxParticleUpdateEmitter=GetProcAddress(lib,"_pxParticleUpdateEmitter@4")
pxParticleGetEntity=GetProcAddress(lib,"_pxParticleGetEntity@4")
pxParticleGetBody=GetProcAddress(lib,"_pxParticleGetBody@4")
pxParticleGetradius=GetProcAddress(lib,"_pxParticleGetradius@4")
 
 
pxKinematicSet=GetProcAddress(lib,"_pxKinematicSet@4")
pxKinematicClear=GetProcAddress(lib,"_pxKinematicClear@4")
pxKinematicMove=GetProcAddress(lib,"_pxKinematicMove@16")
pxKinematicSetPosition=GetProcAddress(lib,"_pxKinematicSetPosition@16")
pxKinematicSetRotation=GetProcAddress(lib,"_pxKinematicSetRotation@16")
 
 
pxCreateMagnet=GetProcAddress(lib,"_pxCreateMagnet@12")
pxMagnetActivate=GetProcAddress(lib,"_pxMagnetActivate@12")
pxMagnetSetPosition=GetProcAddress(lib,"_pxMagnetSetPosition@16")
pxMagnetSetMaxRadius=GetProcAddress(lib,"_pxMagnetSetMaxRadius@8")
pxMagnetSetMinRadius=GetProcAddress(lib,"_pxMagnetSetMinRadius@8")
pxMagnetSetMaxForce=GetProcAddress(lib,"_pxMagnetSetMaxForce@8")
pxMagnetSetMidForce=GetProcAddress(lib,"_pxMagnetSetMidForce@8")
pxMagnetSetMinForce=GetProcAddress(lib,"_pxMagnetSetMinForce@8")
pxMagnetSetMask=GetProcAddress(lib,"_pxMagnetSetMask@8")
pxMagnetGetPositionX=GetProcAddress(lib,"_pxMagnetGetPositionX@4")
pxMagnetGetPositionY=GetProcAddress(lib,"_pxMagnetGetPositionY@4")
pxMagnetGetPositionZ=GetProcAddress(lib,"_pxMagnetGetPositionZ@4")
pxMagnetGetMaxRadius=GetProcAddress(lib,"_pxMagnetGetMaxRadius@4")
pxMagnetGetMinRadius=GetProcAddress(lib,"_pxMagnetGetMinRadius@4")
pxMagnetGetMaxForce=GetProcAddress(lib,"_pxMagnetGetMaxForce@4")
pxMagnetGetMidForce=GetProcAddress(lib,"_pxMagnetGetMidForce@4")
pxMagnetGetMinForce=GetProcAddress(lib,"_pxMagnetGetMinForce@4")
pxMagnetGetMask=GetProcAddress(lib,"_pxMagnetGetMask@4")
pxMagnetDelete=GetProcAddress(lib,"_pxMagnetDelete@4")
 
 
pxCreateWaterCirPlane=GetProcAddress(lib,"_pxCreateWaterCirPlane@8")
pxCreateWaterRectPlane=GetProcAddress(lib,"_pxCreateWaterRectPlane@12")
pxCreateWaterInfinPlane=GetProcAddress(lib,"_pxCreateWaterInfinPlane@4")
pxWaterSetDimension=GetProcAddress(lib,"_pxWaterSetDimension@12")
pxWaterSetRadius=GetProcAddress(lib,"_pxWaterSetRadius@8")
pxWaterSetPosition=GetProcAddress(lib,"_pxWaterSetPosition@16")
pxWaterSetRotation=GetProcAddress(lib,"_pxWaterSetRotation@8")
pxWaterSetFluxion=GetProcAddress(lib,"_pxWaterSetFluxion@16")
pxWaterGetWidth=GetProcAddress(lib,"_pxWaterGetWidth@4")
pxWaterGetHeight=GetProcAddress(lib,"_pxWaterGetHeight@4")
pxWaterGetRadius=GetProcAddress(lib,"_pxWaterGetRadius@4")
pxWaterGetPositionX=GetProcAddress(lib,"_pxWaterGetPositionX@4")
pxWaterGetPositionY=GetProcAddress(lib,"_pxWaterGetPositionY@4")
pxWaterGetPositionZ=GetProcAddress(lib,"_pxWaterGetPositionZ@4")
pxWaterGetRotation=GetProcAddress(lib,"_pxWaterGetRotation@4")
pxWaterGetDepth=GetProcAddress(lib,"_pxWaterGetDepth@4")
pxWaterDelete=GetProcAddress(lib,"_pxWaterDelete@4")
 
pxCreateKep=GetProcAddress(lib,"_pxCreateKep@12")
pxKepAddToBody=GetProcAddress(lib,"_pxKepAddToBody@8")
pxKepSetLocalPosition=GetProcAddress(lib,"_pxKepSetLocalPosition@16")
pxKepSetGlobalPosition=GetProcAddress(lib,"_pxKepSetGlobalPosition@16")
pxKepSetAngularDamping=GetProcAddress(lib,"_pxKepSetAngularDamping@8")
pxKepSetLinearDamping=GetProcAddress(lib,"_pxKepSetLinearDamping@8")
pxWaterUpdate=GetProcAddress(lib,"_pxWaterUpdate@4")
pxKepGetPosX=GetProcAddress(lib,"_pxKepGetPosX@4")
pxKepGetPosY=GetProcAddress(lib,"_pxKepGetPosY@4")
pxKepGetPosZ=GetProcAddress(lib,"_pxKepGetPosZ@4")
pxKepGetNumber=GetProcAddress(lib,"_pxKepGetNumber@4")
pxKepGetKepFromBody=GetProcAddress(lib,"_pxKepGetKepFromBody@8")
 
 
pxTriggerCreateCube=GetProcAddress(lib,"_pxTriggerCreateCube@12")
pxTriggerCreateSphere=GetProcAddress(lib,"_pxTriggerCreateSphere@4")
pxTriggerCreateCapsule=GetProcAddress(lib,"_pxTriggerCreateCapsule@8")
pxTriggerCreateCylinder=GetProcAddress(lib,"_pxTriggerCreateCylinder@12")
pxTriggerCreateHull=GetProcAddress(lib,"_pxTriggerCreateHull@8")
pxTriggerSetPosition=GetProcAddress(lib,"_pxTriggerSetPosition@16")
pxTriggerSetRotation=GetProcAddress(lib,"_pxTriggerSetRotation@16")
pxTriggerGetNumBody=GetProcAddress(lib,"_pxTriggerGetNumBody@4")
pxTriggerGetBody=GetProcAddress(lib,"_pxTriggerGetBody@8")
pxTriggerGetBodyTrigger=GetProcAddress(lib,"_pxTriggerGetBodyTrigger@4")
pxUpdateTriggers=GetProcAddress(lib,"_pxUpdateTriggers@0")
 
 
pxCreateCompoundDesc=GetProcAddress(lib,"_pxCreateCompoundDesc@0")
pxCompoundAddCubeShape=GetProcAddress(lib,"_pxCompoundAddCubeShape@16")
pxCompoundAddSphereShape=GetProcAddress(lib,"_pxCompoundAddSphereShape@8")
pxCompoundAddCapsuleShape=GetProcAddress(lib,"_pxCompoundAddCapsuleShape@12")
pxCompoundAddCylinderShape=GetProcAddress(lib,"_pxCompoundAddCylinderShape@16")
pxCompoundAddHullShape=GetProcAddress(lib,"_pxCompoundAddHullShape@12")
pxCompoundSetShapePos=GetProcAddress(lib,"_pxCompoundSetShapePos@16")
pxCompoundSetShapeRot=GetProcAddress(lib,"_pxCompoundSetShapeRot@16")
pxCreateCompound=GetProcAddress(lib,"_pxCreateCompound@8")
pxCreateStaticCompound=GetProcAddress(lib,"_pxCreateStaticCompound@8")
 
 
pxCreateCloth=GetProcAddress(lib,"_pxCreateCloth@8")
pxCreateTearableCloth=GetProcAddress(lib,"_pxCreateTearableCloth@8")
pxCreateMetalCloth=GetProcAddress(lib,"_pxCreateMetalCloth@20")
pxCreateClothSpec=GetProcAddress(lib,"_pxCreateClothSpec@16")
pxCreateMetalClothSpec=GetProcAddress(lib,"_pxCreateMetalClothSpec@28")
 
pxClothGetAttachmentResponseCoefficient=GetProcAddress(lib,"_pxClothGetAttachmentResponseCoefficient@4")
pxClothGetAttachmentTearFactor=GetProcAddress(lib,"_pxClothGetAttachmentTearFactor@4")
pxClothGetBendingStiffness=GetProcAddress(lib,"_pxClothGetBendingStiffness@4")
pxClothGetCollisionResponseCoefficient=GetProcAddress(lib,"_pxClothGetCollisionResponseCoefficient@4")
pxClothGetDampingCoefficient=GetProcAddress(lib,"_pxClothGetDampingCoefficient@4")
pxClothGetDensity=GetProcAddress(lib,"_pxClothGetDensity@4")
pxClothGetFriction=GetProcAddress(lib,"_pxClothGetFriction@4")
pxClothGetPressure=GetProcAddress(lib,"_pxClothGetPressure@4")
pxClothGetSleepLinearVelocity=GetProcAddress(lib,"_pxClothGetSleepLinearVelocity@4")
pxClothGetStretchingStiffness=GetProcAddress(lib,"_pxClothGetStretchingStiffness@4")
pxClothGetTearFactor=GetProcAddress(lib,"_pxClothGetTearFactor@4")
pxClothGetThickness=GetProcAddress(lib,"_pxClothGetThickness@4")
pxClothGetNumVertices=GetProcAddress(lib,"_pxClothGetNumVertices@4")
pxClothIsSleeping=GetProcAddress(lib,"_pxClothIsSleeping@4")
pxClothGetEntity=GetProcAddress(lib,"_pxClothGetEntity@4")
pxClothGetUserData=GetProcAddress(lib,"_pxClothGetUserData@4")
pxClothPutToSleep=GetProcAddress(lib,"_pxClothPutToSleep@4")
pxClothWakeUp=GetProcAddress(lib,"_pxClothWakeUp@4")
 
pxClothSetTeareble=GetProcAddress(lib,"_pxClothSetTeareble@4")
pxClothSetTearFactor=GetProcAddress(lib,"_pxClothSetTearFactor@8")
 
pxClothSetAttachmentResponseCoefficient=GetProcAddress(lib,"_pxClothSetAttachmentResponseCoefficient@8")
pxClothSetAttachmentTearFactor=GetProcAddress(lib,"_pxClothSetAttachmentTearFactor@8")
pxClothSetBending=GetProcAddress(lib,"_pxClothSetBending@4")
pxClothSetBendingStiffness=GetProcAddress(lib,"_pxClothSetBendingStiffness@8")
pxClothSetCollisionResponseCoefficient=GetProcAddress(lib,"_pxClothSetCollisionResponseCoefficient@8")
pxClothSetDampingCoefficient=GetProcAddress(lib,"_pxClothSetDampingCoefficient@8")
pxClothSetComDampingCoefficient=GetProcAddress(lib,"_pxClothSetComDampingCoefficient@8")
pxClothSetFriction=GetProcAddress(lib,"_pxClothSetFriction@8")
pxClothSetPressure=GetProcAddress(lib,"_pxClothSetPressure@8")
pxClothSetSleepLinearVelocity=GetProcAddress(lib,"_pxClothSetSleepLinearVelocity@8")
pxClothSetStretchingStiffness=GetProcAddress(lib,"_pxClothSetStretchingStiffness@8")
pxClothSetThickness=GetProcAddress(lib,"_pxClothSetThickness@8")
pxClothSetUserData=GetProcAddress(lib,"_pxClothSetUserData@8")
pxClothMaskSet=GetProcAddress(lib,"_pxClothMaskSet@8")
pxClothMaskCombineSet=GetProcAddress(lib,"_pxClothMaskCombineSet@8")
 
pxClothSetVertexPos=GetProcAddress(lib,"_pxClothSetVertexPos@12")
pxClothGetVertexPos=GetProcAddress(lib,"_pxClothGetVertexPos@12")
pxClothGetNormals=GetProcAddress(lib,"_pxClothGetNormals@8")
 
pxClothAttachVertexToPos=GetProcAddress(lib,"_pxClothAttachVertexToPos@20")
pxClothAttachToCollidingShapes=GetProcAddress(lib,"_pxClothAttachToCollidingShapes@4")
pxClothAddForceAtPos=GetProcAddress(lib,"_pxClothAddForceAtPos@24")
pxClothAddForceAtVertex=GetProcAddress(lib,"_pxClothAddForceAtVertex@20")
pxUpdateCloth=GetProcAddress(lib,"_pxUpdateCloth@0")
pxClothDelete=GetProcAddress(lib,"_pxClothDelete@4")
 
 
pxCreateSpringAndDamperEffector=GetProcAddress(lib,"_pxCreateSpringAndDamperEffector@8")
pxSetLinearSpring=GetProcAddress(lib,"_pxSetLinearSpring@24")
pxSetLinearDamper=GetProcAddress(lib,"_pxSetLinearDamper@20")
pxDeleteEffector=GetProcAddress(lib,"_pxDeleteEffector@4")
 
 
pxWheelAddToBody=GetProcAddress(lib,"_pxWheelAddToBody@16")
pxWheelSetRadius=GetProcAddress(lib,"_pxWheelSetRadius@8")
pxWheelSetRotation=GetProcAddress(lib,"_pxWheelSetRotation@16")
pxWheelSetMotorTorque=GetProcAddress(lib,"_pxWheelSetMotorTorque@8")
pxWheelSetSteerAngle=GetProcAddress(lib,"_pxWheelSetSteerAngle@8")
pxWheelSetBrakeTorque=GetProcAddress(lib,"_pxWheelSetBrakeTorque@8")
pxWheelSetSuspension=GetProcAddress(lib,"_pxWheelSetSuspension@16")
pxWheelSetFrictionToSide=GetProcAddress(lib,"_pxWheelSetFrictionToSide@8")
pxWheelSetFrictionToFront=GetProcAddress(lib,"_pxWheelSetFrictionToFront@8")
pxWheelSetCollisionGroup=GetProcAddress(lib,"_pxWheelSetCollisionGroup@8")
 
pxWheelGetSteerAngle=GetProcAddress(lib,"_pxWheelGetSteerAngle@4")
pxWheelGetAxleSpeed=GetProcAddress(lib,"_pxWheelGetAxleSpeed@4")
pxWheelGetRadius=GetProcAddress(lib,"_pxWheelGetRadius@4")
pxWheelGetSuspensionTravel=GetProcAddress(lib,"_pxWheelGetSuspensionTravel@4")
pxWheelGetSuspensionRestitution=GetProcAddress(lib,"_pxWheelGetSuspensionRestitution@4")
pxWheelGetSuspensionDamping=GetProcAddress(lib,"_pxWheelGetSuspensionDamping@4")
 
pxWheelGetPositionX=GetProcAddress(lib,"_pxWheelGetPositionX@4")
pxWheelGetPositionY=GetProcAddress(lib,"_pxWheelGetPositionY@4")
pxWheelGetPositionZ=GetProcAddress(lib,"_pxWheelGetPositionZ@4")
pxWheelUpdateSpec=GetProcAddress(lib,"_pxWheelUpdateSpec@8")
pxWheelGetPositionXSpec=GetProcAddress(lib,"_pxWheelGetPositionXSpec@4")
pxWheelGetPositionYSpec=GetProcAddress(lib,"_pxWheelGetPositionYSpec@4")
pxWheelGetPositionZSpec=GetProcAddress(lib,"_pxWheelGetPositionZSpec@4")
pxWheelGetRotationPitchSpec=GetProcAddress(lib,"_pxWheelGetRotationPitchSpec@4")
pxWheelGetRotationYawSpec=GetProcAddress(lib,"_pxWheelGetRotationYawSpec@4")
pxWheelGetRotationRollSpec=GetProcAddress(lib,"_pxWheelGetRotationRollSpec@4")
 
pxWheelGetContactX=GetProcAddress(lib,"_pxWheelGetContactX@4")
pxWheelGetContactY=GetProcAddress(lib,"_pxWheelGetContactY@4")
pxWheelGetContactZ=GetProcAddress(lib,"_pxWheelGetContactZ@4")
pxWheelGetContactForce=GetProcAddress(lib,"_pxWheelGetContactForce@4")
pxWheelGetContactLatDirectionX=GetProcAddress(lib,"_pxWheelGetContactLatDirectionX@4")
pxWheelGetContactLatDirectionY=GetProcAddress(lib,"_pxWheelGetContactLatDirectionY@4")
pxWheelGetContactLatDirectionZ=GetProcAddress(lib,"_pxWheelGetContactLatDirectionZ@4")
pxWheelGetContactLatImpulse=GetProcAddress(lib,"_pxWheelGetContactLatImpulse@4")
pxWheelGetContactLonDirectionX=GetProcAddress(lib,"_pxWheelGetContactLonDirectionX@4")
pxWheelGetContactLonDirectionY=GetProcAddress(lib,"_pxWheelGetContactLonDirectionY@4")
pxWheelGetContactLonDirectionZ=GetProcAddress(lib,"_pxWheelGetContactLonDirectionZ@4")
pxWheelGetContactLonImpulse=GetProcAddress(lib,"_pxWheelGetContactLonImpulse@4")
pxWheelGetContactMaterial=GetProcAddress(lib,"_pxWheelGetContactMaterial@4")
pxWheelGetFrictionToSide=GetProcAddress(lib,"_pxWheelGetFrictionToSide@4")
pxWheelGetFrictionToFront=GetProcAddress(lib,"_pxWheelGetFrictionToFront@4")
 
pxWheelSetMask=GetProcAddress(lib,"_pxWheelSetMask@8")
pxWheelSetMaskCombine=GetProcAddress(lib,"_pxWheelSetMaskCombine@8")
pxWheelClearMask=GetProcAddress(lib,"_pxWheelClearMask@4")
pxWheelDelete=GetProcAddress(lib,"_pxWheelDelete@4")
 
 
pxJointCreateSuspFront=GetProcAddress(lib,"_pxJointCreateSuspFront@20")
pxJointCreateSuspBack=GetProcAddress(lib,"_pxJointCreateSuspBack@20")
pxJointSuspSetSteerN=GetProcAddress(lib,"_pxJointSuspSetSteerN@16")
pxJointSuspSetTurnN=GetProcAddress(lib,"_pxJointSuspSetTurnN@16")
pxJointSuspSetLinLimit=GetProcAddress(lib,"_pxJointSuspSetLinLimit@8")
pxJointSuspSetLinParameter=GetProcAddress(lib,"_pxJointSuspSetLinParameter@16")
pxJointSuspSetAngLimit=GetProcAddress(lib,"_pxJointSuspSetAngLimit@8")
pxJointSuspSetAngParameter=GetProcAddress(lib,"_pxJointSuspSetAngParameter@16")
pxJointSuspSetAngle=GetProcAddress(lib,"_pxJointSuspSetAngle@8")
pxJointSuspSetSpeed=GetProcAddress(lib,"_pxJointSuspSetSpeed@8")
pxJointSuspSetBrake=GetProcAddress(lib,"_pxJointSuspSetBrake@8")
 
 
pxCCDSkeletonEnable=GetProcAddress(lib,"_pxCCDSkeletonEnable@4")
pxCCDSkeletonSetEpsilon=GetProcAddress(lib,"_pxCCDSkeletonSetEpsilon@4")
pxBodySetCCDSkeleton=GetProcAddress(lib,"_pxBodySetCCDSkeleton@16")
pxBodySetCCDSkeletonThreshold=GetProcAddress(lib,"_pxBodySetCCDSkeletonThreshold@8")
pxBodySetFlagCCDSkeletonDynamic=GetProcAddress(lib,"_pxBodySetFlagCCDSkeletonDynamic@4")
pxBodyGetCCDSkeleton=GetProcAddress(lib,"_pxBodyGetCCDSkeleton@4")
pxBodyDeleteCCDSkeleton=GetProcAddress(lib,"_pxBodyDeleteCCDSkeleton@4")
 
 
pxCreateRay=GetProcAddress(lib,"_pxCreateRay@0")
pxRaySetDir=GetProcAddress(lib,"_pxRaySetDir@16")
pxRaySetPosition=GetProcAddress(lib,"_pxRaySetPosition@16")
pxRayGetDistance=GetProcAddress(lib,"_pxRayGetDistance@8")
pxRayGetBody=GetProcAddress(lib,"_pxRayGetBody@8")
pxRayGetMaterial=GetProcAddress(lib,"_pxRayGetMaterial@8")
pxRayGetPickX=GetProcAddress(lib,"_pxRayGetPickX@8")
pxRayGetPickY=GetProcAddress(lib,"_pxRayGetPickY@8")
pxRayGetPickZ=GetProcAddress(lib,"_pxRayGetPickZ@8")
pxRayGetPickNX=GetProcAddress(lib,"_pxRayGetPickNX@8")
pxRayGetPickNY=GetProcAddress(lib,"_pxRayGetPickNY@8")
pxRayGetPickNZ=GetProcAddress(lib,"_pxRayGetPickNZ@8")
 
 
pxRegWriteDriverPath=GetProcAddress(lib,"_pxRegWriteDriverPath@4")
pxRegWriteString=GetProcAddress(lib,"_pxRegWriteString@16")
pxRegWriteInt=GetProcAddress(lib,"_pxRegWriteInt@16")
pxRegReadInt=GetProcAddress(lib,"_pxRegReadInt@12")
pxRegReadString=GetProcAddress(lib,"_pxRegReadString@12")
pxRegDeleteValue=GetProcAddress(lib,"_pxRegDeleteValue@12")
pxRegDeleteKey=GetProcAddress(lib,"_pxRegDeleteKey@12")
 
 
pxGetContacts=GetProcAddress(lib,"_pxGetContacts@4")
pxContactGetBody=GetProcAddress(lib,"_pxContactGetBody@8")
pxContactGetPointX=GetProcAddress(lib,"_pxContactGetPointX@8")
pxContactGetPointY=GetProcAddress(lib,"_pxContactGetPointY@8")
pxContactGetPointZ=GetProcAddress(lib,"_pxContactGetPointZ@8")
pxContactGetPointNX=GetProcAddress(lib,"_pxContactGetPointNX@8")
pxContactGetPointNY=GetProcAddress(lib,"_pxContactGetPointNY@8")
pxContactGetPointNZ=GetProcAddress(lib,"_pxContactGetPointNZ@8")
pxContactGetForceN=GetProcAddress(lib,"_pxContactGetForceN@8")
pxContactGetForceNX=GetProcAddress(lib,"_pxContactGetForceNX@8")
pxContactGetForceNY=GetProcAddress(lib,"_pxContactGetForceNY@8")
pxContactGetForceNZ=GetProcAddress(lib,"_pxContactGetForceNZ@8")
pxContactGetForceT=GetProcAddress(lib,"_pxContactGetForceT@8")
pxContactGetForceTX=GetProcAddress(lib,"_pxContactGetForceTX@8")
pxContactGetForceTY=GetProcAddress(lib,"_pxContactGetForceTY@8")
pxContactGetForceTZ=GetProcAddress(lib,"_pxContactGetForceTZ@8")
pxContactEventsOnStartTouch=GetProcAddress(lib,"_pxContactEventsOnStartTouch@4")
pxContactEventsOnEndTouch=GetProcAddress(lib,"_pxContactEventsOnEndTouch@4")
 
 
pxMaskSet=GetProcAddress(lib,"_pxMaskSet@8")
pxMaskCombineSet=GetProcAddress(lib,"_pxMaskCombineSet@8")
pxMaskClear=GetProcAddress(lib,"_pxMaskClear@4")
pxBodySetCollisionGroup=GetProcAddress(lib,"_pxBodySetCollisionGroup@8")
pxBodySetCollisionGroupPair=GetProcAddress(lib,"_pxBodySetCollisionGroupPair@8")
pxBodySetCollisionGroupFlag=GetProcAddress(lib,"_pxBodySetCollisionGroupFlag@12")
pxBodySetMagnetMask=GetProcAddress(lib,"_pxBodySetMagnetMask@8")
pxBodyGetMagnetMask=GetProcAddress(lib,"_pxBodyGetMagnetMask@4")
 
 
pxBodySetFrozen=GetProcAddress(lib,"_pxBodySetFrozen@8")
pxBodySetFrozenRotX=GetProcAddress(lib,"_pxBodySetFrozenRotX@8")
pxBodySetFrozenRotY=GetProcAddress(lib,"_pxBodySetFrozenRotY@8")
pxBodySetFrozenRotZ=GetProcAddress(lib,"_pxBodySetFrozenRotZ@8")
pxBodySetFrozenRot=GetProcAddress(lib,"_pxBodySetFrozenRot@8")
pxBodySetFrozenPosX=GetProcAddress(lib,"_pxBodySetFrozenPosX@8")
pxBodySetFrozenPosY=GetProcAddress(lib,"_pxBodySetFrozenPosY@8")
pxBodySetFrozenPosZ=GetProcAddress(lib,"_pxBodySetFrozenPosZ@8")
pxBodySetFrozenPos=GetProcAddress(lib,"_pxBodySetFrozenPos@8")
pxBodySetFlagGravity=GetProcAddress(lib,"_pxBodySetFlagGravity@8")
pxBodySetFlagCollision=GetProcAddress(lib,"_pxBodySetFlagCollision@8")
pxBodySetFlagResponse=GetProcAddress(lib,"_pxBodySetFlagResponse@8")
pxBodySetFlagContacttable=GetProcAddress(lib,"_pxBodySetFlagContacttable@8")
pxBodySetFlagMagniteble=GetProcAddress(lib,"_pxBodySetFlagMagniteble@8")
pxBodySetFlagTriggertable=GetProcAddress(lib,"_pxBodySetFlagTriggertable@8")
pxBodySetFlagRayCast=GetProcAddress(lib,"_pxBodySetFlagRayCast@8")
 
 
pxDeleteBody=GetProcAddress(lib,"_pxDeleteBody@4")
pxDeleteJoint=GetProcAddress(lib,"_pxDeleteJoint@4")
 
 
pxJointCreateHinge=GetProcAddress(lib,"_pxJointCreateHinge@32")
pxJointCreateSpherical=GetProcAddress(lib,"_pxJointCreateSpherical@32")
pxJointCreateDistance=GetProcAddress(lib,"_pxJointCreateDistance@32")
pxJointCreateFixed=GetProcAddress(lib,"_pxJointCreateFixed@8")
pxJointCreateCylindrical=GetProcAddress(lib,"_pxJointCreateCylindrical@40")
pxJointCreatePrismatic=GetProcAddress(lib,"_pxJointCreatePrismatic@40")
pxJointCreateOnLine=GetProcAddress(lib,"_pxJointCreateOnLine@28")
pxJointCreateInPlane=GetProcAddress(lib,"_pxJointCreateInPlane@28")
pxJointCreatePulley=GetProcAddress(lib,"_pxJointCreatePulley@20")
 
pxJointCreateD6Joint=GetProcAddress(lib,"_pxJointCreateD6Joint@32")
pxD6JointSetPosMotion=GetProcAddress(lib,"_pxD6JointSetPosMotion@16")
pxD6JointSetAngleMotion=GetProcAddress(lib,"_pxD6JointSetAngleMotion@16")
pxD6JointSetLinearLimit=GetProcAddress(lib,"_pxD6JointSetLinearLimit@8")
pxD6JointSetSwingLimit=GetProcAddress(lib,"_pxD6JointSetSwingLimit@12")
pxD6JointSetTwistLimit=GetProcAddress(lib,"_pxD6JointSetTwistLimit@12")
 
pxJointHingeSetLimit=GetProcAddress(lib,"_pxJointHingeSetLimit@12")
pxJointHingeSetSpring=GetProcAddress(lib,"_pxJointHingeSetSpring@12")
pxJointSphericalSetLimitAngle=GetProcAddress(lib,"_pxJointSphericalSetLimitAngle@16")
pxJointSphericalSetLimitTwist=GetProcAddress(lib,"_pxJointSphericalSetLimitTwist@24")
pxJointSphericalSetLimitSpring=GetProcAddress(lib,"_pxJointSphericalSetLimitSpring@16")
pxJointDistanceSetPoint=GetProcAddress(lib,"_pxJointDistanceSetPoint@12")
pxJointDistanceSetSpring=GetProcAddress(lib,"_pxJointDistanceSetSpring@12")
pxJointAddLimitPlane=GetProcAddress(lib,"_pxJointAddLimitPlane@28")
pxJointPulleySetAnchor=GetProcAddress(lib,"_pxJointPulleySetAnchor@28")
pxJointPulleySetLocalAttachBody=GetProcAddress(lib,"_pxJointPulleySetLocalAttachBody@28")
pxJointHingeSetMotor=GetProcAddress(lib,"_pxJointHingeSetMotor@12")
pxJointSetBreakable=GetProcAddress(lib,"_pxJointSetBreakable@12")
pxJointIsBroken=GetProcAddress(lib,"_pxJointIsBroken@4")
pxJointHingeSetCollision=GetProcAddress(lib,"_pxJointHingeSetCollision@4")
pxJointSphericalSetCollision=GetProcAddress(lib,"_pxJointSphericalSetCollision@4")
pxJointDistanceSetCollision=GetProcAddress(lib,"_pxJointDistanceSetCollision@4")
pxJointCylindricalSetCollision=GetProcAddress(lib,"_pxJointCylindricalSetCollision@4")
 
 
pxSetGravity=GetProcAddress(lib,"_pxSetGravity@12")
pxBodySetMass=GetProcAddress(lib,"_pxBodySetMass@8")
pxBodySetCMassLocalPosition=GetProcAddress(lib,"_pxBodySetCMassLocalPosition@16")
pxBodySetCMassGlobalPosition=GetProcAddress(lib,"_pxBodySetCMassGlobalPosition@16")
pxBodySetMassSpaceInertiaTensor=GetProcAddress(lib,"_pxBodySetMassSpaceInertiaTensor@16")
pxBodyGetCMassGlobalPositionX=GetProcAddress(lib,"_pxBodyGetCMassGlobalPositionX@4")
pxBodyGetCMassGlobalPositionY=GetProcAddress(lib,"_pxBodyGetCMassGlobalPositionY@4")
pxBodyGetCMassGlobalPositionZ=GetProcAddress(lib,"_pxBodyGetCMassGlobalPositionZ@4")
pxBodyGetCMassLocalPositionX=GetProcAddress(lib,"_pxBodyGetCMassLocalPositionX@4")
pxBodyGetCMassLocalPositionY=GetProcAddress(lib,"_pxBodyGetCMassLocalPositionY@4")
pxBodyGetCMassLocalPositionZ=GetProcAddress(lib,"_pxBodyGetCMassLocalPositionZ@4")
pxBodyGetMass=GetProcAddress(lib,"_pxBodyGetMass@4")
 
 
pxBodySetMyForce=GetProcAddress(lib,"_pxBodySetMyForce@16")
pxBodyAddForce=GetProcAddress(lib,"_pxBodyAddForce@20")
pxBodyAddForceAtPos=GetProcAddress(lib,"_pxBodyAddForceAtPos@32")
pxBodyAddForceAtLocalPos=GetProcAddress(lib,"_pxBodyAddForceAtLocalPos@32")
pxBodyAddLocalForce=GetProcAddress(lib,"_pxBodyAddLocalForce@20")
pxBodyAddLocalForceAtPos=GetProcAddress(lib,"_pxBodyAddLocalForceAtPos@32")
pxBodyAddLocalForceAtLocalPos=GetProcAddress(lib,"_pxBodyAddLocalForceAtLocalPos@32")
 
pxBodyAddTorque=GetProcAddress(lib,"_pxBodyAddTorque@20")
pxBodyAddLocalTorque=GetProcAddress(lib,"_pxBodyAddLocalTorque@20")
pxBodySetAngularSpeed=GetProcAddress(lib,"_pxBodySetAngularSpeed@16")
pxBodySetLinearSpeed=GetProcAddress(lib,"_pxBodySetLinearSpeed@16")
pxBodySetLocalLinearSpeed=GetProcAddress(lib,"_pxBodySetLocalLinearSpeed@16")
pxBodySetLocalAngularSpeed=GetProcAddress(lib,"_pxBodySetLocalAngularSpeed@16")
pxBodySetAngularDamping=GetProcAddress(lib,"_pxBodySetAngularDamping@8")
pxBodySetLinearDamping=GetProcAddress(lib,"_pxBodySetLinearDamping@8")
pxBodySetAngularMomentum=GetProcAddress(lib,"_pxBodySetAngularMomentum@16")
pxBodySetLinearMomentum=GetProcAddress(lib,"_pxBodySetLinearMomentum@16")
pxBodySetMaxAngularSpeed=GetProcAddress(lib,"_pxBodySetMaxAngularSpeed@8")
pxBodySetSleepEnergyThreshold=GetProcAddress(lib,"_pxBodySetSleepEnergyThreshold@8")
pxBodySetSleepAngularVelocity=GetProcAddress(lib,"_pxBodySetSleepAngularVelocity@8")
pxBodySetSleepLinearVelocity=GetProcAddress(lib,"_pxBodySetSleepLinearVelocity@8")
pxBodySetSleepWakeUp=GetProcAddress(lib,"_pxBodySetSleepWakeUp@8")
pxBodySetSleepPut=GetProcAddress(lib,"_pxBodySetSleepPut@4")
pxBodySetSolverIterationCount=GetProcAddress(lib,"_pxBodySetSolverIterationCount@8")
pxBodySetBodyName=GetProcAddress(lib,"_pxBodySetBodyName@8")
pxBodySetBodyEntity=GetProcAddress(lib,"_pxBodySetBodyEntity@8")
pxBodySetBodyUserData=GetProcAddress(lib,"_pxBodySetBodyUserData@8")
pxMoveBodyToPoint=GetProcAddress(lib,"_pxMoveBodyToPoint@20")
pxAddBodytoBody=GetProcAddress(lib,"_pxAddBodytoBody@8")
pxCopyBody=GetProcAddress(lib,"_pxCopyBody@4")
 
 
pxCreateMaterial=GetProcAddress(lib,"_pxCreateMaterial@0")
pxMaterialSetToBody=GetProcAddress(lib,"_pxMaterialSetToBody@8")
pxMaterialSetRestitution=GetProcAddress(lib,"_pxMaterialSetRestitution@8")
pxMaterialSetRestitutionCombineMode=GetProcAddress(lib,"_pxMaterialSetRestitutionCombineMode@8")
pxMaterialSetStFriction=GetProcAddress(lib,"_pxMaterialSetStFriction@8")
pxMaterialSetDyFriction=GetProcAddress(lib,"_pxMaterialSetDyFriction@8")
pxMaterialSetFrictionV=GetProcAddress(lib,"_pxMaterialSetFrictionV@12")
pxMaterialSetFrictionCombineMode=GetProcAddress(lib,"_pxMaterialSetFrictionCombineMode@8")
pxCreateAnisotripicMaterial=GetProcAddress(lib,"_pxCreateAnisotripicMaterial@12")
pxMaterialSetFlagStrongFriction=GetProcAddress(lib,"_pxMaterialSetFlagStrongFriction@4")
pxGetMaterial=GetProcAddress(lib,"_pxGetMaterial@4")
 
 
pxBodySetPosition=GetProcAddress(lib,"_pxBodySetPosition@16")
pxBodySetRotation=GetProcAddress(lib,"_pxBodySetRotation@16")
 
pxBodyGetPositionX=GetProcAddress(lib,"_pxBodyGetPositionX@4")
pxBodyGetPositionY=GetProcAddress(lib,"_pxBodyGetPositionY@4")
pxBodyGetPositionZ=GetProcAddress(lib,"_pxBodyGetPositionZ@4")
pxBodyGetRotationPitch=GetProcAddress(lib,"_pxBodyGetRotationPitch@4")
pxBodyGetRotationYaw=GetProcAddress(lib,"_pxBodyGetRotationYaw@4")
pxBodyGetRotationRoll=GetProcAddress(lib,"_pxBodyGetRotationRoll@4")
pxBodyGetAngularSpeed=GetProcAddress(lib,"_pxBodyGetAngularSpeed@4")
pxBodyGetAngularSpeedX=GetProcAddress(lib,"_pxBodyGetAngularSpeedX@4")
pxBodyGetAngularSpeedY=GetProcAddress(lib,"_pxBodyGetAngularSpeedY@4")
pxBodyGetAngularSpeedZ=GetProcAddress(lib,"_pxBodyGetAngularSpeedZ@4")
pxBodyGetLinearSpeed=GetProcAddress(lib,"_pxBodyGetLinearSpeed@4")
pxBodyGetLinearSpeedX=GetProcAddress(lib,"_pxBodyGetLinearSpeedX@4")
pxBodyGetLinearSpeedY=GetProcAddress(lib,"_pxBodyGetLinearSpeedY@4")
pxBodyGetLinearSpeedZ=GetProcAddress(lib,"_pxBodyGetLinearSpeedZ@4")
pxBodyGetLocalLinearSpeedX=GetProcAddress(lib,"_pxBodyGetLocalLinearSpeedX@4")
pxBodyGetLocalLinearSpeedY=GetProcAddress(lib,"_pxBodyGetLocalLinearSpeedY@4")
pxBodyGetLocalLinearSpeedZ=GetProcAddress(lib,"_pxBodyGetLocalLinearSpeedZ@4")
pxBodyGetLinearVecSpeedX=GetProcAddress(lib,"_pxBodyGetLinearVecSpeedX@4")
pxBodyGetLinearVecSpeedY=GetProcAddress(lib,"_pxBodyGetLinearVecSpeedY@4")
pxBodyGetLinearVecSpeedZ=GetProcAddress(lib,"_pxBodyGetLinearVecSpeedZ@4")
pxBodyGetLocalPointSpeed=GetProcAddress(lib,"_pxBodyGetLocalPointSpeed@12")
pxBodyGetLocalPointSpeedX=GetProcAddress(lib,"_pxBodyGetLocalPointSpeedX@12")
pxBodyGetLocalPointSpeedY=GetProcAddress(lib,"_pxBodyGetLocalPointSpeedY@12")
pxBodyGetLocalPointSpeedZ=GetProcAddress(lib,"_pxBodyGetLocalPointSpeedZ@12")
 
 
pxBodyGetAngularDamping=GetProcAddress(lib,"_pxBodyGetAngularDamping@4")
pxBodyGetLinearDamping=GetProcAddress(lib,"_pxBodyGetLinearDamping@4")
pxBodyGetAngularMomentum=GetProcAddress(lib,"_pxBodyGetAngularMomentum@4")
pxBodyGetLinearMomentum=GetProcAddress(lib,"_pxBodyGetLinearMomentum@4")
pxBodyGetMaxAngularVelocity=GetProcAddress(lib,"_pxBodyGetMaxAngularVelocity@4")
pxGetBodyName=GetProcAddress(lib,"_pxGetBodyName@4")
pxGetBodyEntity=GetProcAddress(lib,"_pxGetBodyEntity@4")
pxGetBodyUserData=GetProcAddress(lib,"_pxGetBodyUserData@4")
pxBodyGetSleepAngularVelocity=GetProcAddress(lib,"_pxBodyGetSleepAngularVelocity@4")
pxBodyGetSleepLinearVelocity=GetProcAddress(lib,"_pxBodyGetSleepLinearVelocity@4")
pxBodyIsDynamic=GetProcAddress(lib,"_pxBodyIsDynamic@4")
pxBodyIsSleeping=GetProcAddress(lib,"_pxBodyIsSleeping@4")
 
 
pxGetNumberAllBody=GetProcAddress(lib,"_pxGetNumberAllBody@0")
pxCreateWorld=GetProcAddress(lib,"_pxCreateWorld@8")
pxDestroyWorld=GetProcAddress(lib,"_pxDestroyWorld@0")
pxRenderPhysic=GetProcAddress(lib,"_pxRenderPhysic@8")
pxSetTiming=GetProcAddress(lib,"_pxSetTiming@12")
pxSDKSetParameter=GetProcAddress(lib,"_pxSDKSetParameter@4")
pxSetPause=GetProcAddress(lib,"_pxSetPause@4")
pxChekPPU=GetProcAddress(lib,"_pxChekPPU@0")
pxChekPPUMode=GetProcAddress(lib,"_pxChekPPUMode@0")
pxSetHardwareSimulation=GetProcAddress(lib,"_pxSetHardwareSimulation@4")
 
pxCreateScene=GetProcAddress(lib,"_pxCreateScene@0")
pxSceneChange=GetProcAddress(lib,"_pxSceneChange@4")
 
 
pxBodyAddEntity=GetProcAddress(lib,"_pxBodyAddEntity@8")
 
peeksint=GetProcAddress(lib,"_peeksint@4")
 
pxGetAngleBetweenVec=GetProcAddress(lib,"_pxGetAngleBetweenVec@24")

Else
End
EndIf

Re: Strange rotation

Also, it appears that I have the pitch and roll working, with this code

If eYaw =-180 And eRoll=180
          ePitch = 180 - ePitch
    eRoll = 0
       EndIf

    If eYaw =180 And eRoll=-180
          ePitch = -180 - ePitch
    eRoll = 0
       EndIf

But if I mix two direction on the slope, so the sphere is falling at a 45 degree angle, the rotations are wrong again, it's almost like Irrlicht is getting confused, so you need code like above to govern it.

Re: Strange rotation

thx for the code.  i will try to run it tonight.  meanwhile last night i spent significant time researching on the irrlicht forums.  seems that lots of folks have problems with physics systems and applying rotation.  i never really found a good solution unfortunately.  for ODE, the rotations are provided in quaternions and there is a routine someone wrote that appears to function.

14 (edited by Slaine 2007-06-05 14:08:23)

Re: Strange rotation

Thanks gman, I too have spent so much time researchng this, the irrlicht forum has been very unhelpfull with little to no straight forward solution, I can only seem to get close with the current code I've supplied, it's the multi angle slope which is causing problems, as in mixing more than one direction to the rotation.  It's a shame really because Irrlicht and your wrapper seem to be the best out there.  I cant use ODE, it's way to complicated to get going with oop structuring, PhysX is extremely simple to use and very powerfull, it's showing great potential, the actual c++ version is a direct competitor to Havok and has one awards in the games industry, I have a feeling this is the only problem that will arrise with Irrlicht and PhysX.  I hope we can solve it.

Re: Strange rotation

is there a way to get the rotation from PhysX as a quat?  if so there is a solution out there that would be easy to implement (from the ODE tutorial).

Re: Strange rotation

I did at one time create a euler to quat function, but that didn't seem to change anything.  But at the moment the getpitch roll and yaw functions that PhysX returns as a Float.  I dont fully understand quats and euler so the results it was returning didn't really make much sense to me, so I dismissed it.

Re: Strange rotation

pxBodyGetRotationQuatX(sphereBody)
pxBodyGetRotationQuatY(sphereBody)
pxBodyGetRotationQuatZ(sphereBody)

Re: Strange rotation

i wont have time for several hours yet to look at this, but here is the C++ code from the ODE tutorial that converts an ODE quat to the eulers needed by Irrlicht.  the process should be pretty much the same for PhysX.  just need to pass the euler vector3df into setRotation.

void Bounceable::QuaternionToEuler(const dQuaternion quaternion, vector3df &euler){
  dReal w,x,y,z;
  w=quaternion[0];
  x=quaternion[1];
  y=quaternion[2];
  z=quaternion[3];
  double sqw = w*w;    
  double sqx = x*x;    
  double sqy = y*y;    
  double sqz = z*z; 
  
  euler.Z = (irr::f32) (atan2(2.0 * (x*y + z*w),(sqx - sqy - sqz + sqw))
                        *irr::core::GRAD_PI);
  
  euler.X = (irr::f32) (atan2(2.0 * (y*z + x*w),(-sqx - sqy + sqz + sqw))
                        *irr::core::GRAD_PI);  
  
  euler.Y = (irr::f32) (asin(-2.0 * (x*z - y*w))
                        *irr::core::GRAD_PI);
}

Re: Strange rotation

i just noticed that since that tutorial, there is now a toEuler() method on the Irrlicht quaternion class.  this makes things easier.  so try this (untested):

Local quat:Quaternion = ..
    Quaternion.createFrom4Vals(pxBodyGetRotationQuatX(sphereBody),pxBodyGetRotationQuatY(sphereBody),pxBodyGetRotationQuatZ(sphereBody))
Local euler:Vector3df = _VECTOR3DF()

quat.toEuler(euler)

sphere_node.setRotation(euler)

Re: Strange rotation

I've tried the above code but again the sphere doesn't rotate.  Do you think it is definatly something to do with the translation between PhysX and Irrlicht?

Re: Strange rotation

well the overall problem from what ive read is the use of eulers to rotate the node.  supposedly you can rotate using quats and its supposed to resolve rotation issues.  what is the output of the getrotationquat functions?

Re: Strange rotation

I'm not sure how to output it yet, it's not like

pitch = getrotationPitch(body)
DeBug pitch

I'll have to figure out how to adjust your code tomorrow to return the angles.

Re: Strange rotation

just do:

DebugLog(pxBodyGetRotationQuatX(sphereBody)+" | "+pxBodyGetRotationQuatY(sphereBody)+" | "+pxBodyGetRotationQuatZ(sphereBody))

be sure your compiling in debug mode.  lets make sure those functions are returning values.

Re: Strange rotation

Ah, that worked. The results are pretty strange, it counts from 0.0 to -0.99999 then back again.  This could be why we cant see anything, it's only rotating to 1 degree, but at the same time it's still bouncing back not carrying on rotating, even if it is only getting to 1 degree.

Re: Strange rotation

Hi gman, I've been told to show you this function, it may help solve this problem.  It transforms Euler to Quat.

Quat RotationQuat = 
        Quat( Vec3( 0, Sin(degToRad(yaw*0.5)),0 ), - Cos(degToRad(yaw*0.5))) * 
        Quat( Vec3(Sin(degToRad(-pitch*0.5)),0,0 ), - Cos(degToRad(-pitch*0.5))) * 
        Quat( Vec3( 0,0, Sin(degToRad(-roll*0.5))), - Cos(degToRad(-roll*0.5)));