Topic: ageia physX force freezing?

SuperStrict
Framework Irrlicht.Core
Import "PhysX_func.bmx"

Global fX:Float = 0
Global fY:Float = 0
Global fZ:Float = 0
Global force:Float = 1.0

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

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

Local device:IrrlichtDevice = IrrlichtDevice.create(EDT_DIRECT3D8,_DIMENSION2DI(800,600),16,False,True)
Local driver:IVideoDriver=device.getVideoDriver()
Local smgr:ISceneManager=device.getSceneManager()

Local receiver:IEventReceiver=IEventReceiver.create(MyEventReceiver.generate)
device.setEventReceiver(receiver)

Type MyEventReceiver Extends IEventReceiver
    Method OnEvent:Int(event:SEvent)

        If event.getEventType()=EET_KEY_INPUT_EVENT
            Local key:Int=event.getKeyInputKey()
            Select key
                Case EKEY_KEY_A
                    fX = -force
                Case EKEY_KEY_D
                    fX = force
                Case EKEY_KEY_W
                    fY = force
                Case EKEY_KEY_S
                    fY = -force
                Return True
            EndSelect
        EndIf
        
        If event.getEventType()=EET_KEY_INPUT_EVENT And event.getKeyPressedDown()=False
            Local key:Int=event.getKeyInputKey()
            Select key
                Case EKEY_KEY_A
                    fX = 0
                Case EKEY_KEY_D
                    fX = 0
                Case EKEY_KEY_W
                    fY = 0
                Case EKEY_KEY_S
                    fY = 0                    
                Return True
            EndSelect
        EndIf

        Return False
    EndMethod

    Function generate:IEventReceiver()
        Return New MyEventReceiver
    EndFunction
EndType

'create camera
Local camera:ICameraSceneNode = smgr.addCameraSceneNodeMAYA()
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()

'physX bodies
Local sphereBody% = PxBodyCreateSphere(4, 20)
pxBodySetPosition(sphereBody,0, 0, 0)

While(device.run())
    If (device.isWindowActive())
    
        driver.beginScene(True, True, Null)
        
        sphere_node.setPosition(_VECTOR3DF(pxBodyGetPositionX(sphereBody),pxBodyGetPositionY(sphereBody),pxBodyGetPositionZ(sphereBody)))

        pxBodyAddForce(sphereBody, fX,fY,fZ, 0)
        pxRenderPhysic(60 , 0)

        smgr.drawAll()
        driver.endScene()
    EndIf    
Wend    
    
device.drop()

Re: ageia physX force freezing?