• Advertisement
Sign in to follow this  

Updatetime slimdx pHysx

This topic is 2882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi am trying to make some tutorials of physx in slimdx and i need a function to update time in the tutorial of physx for c++ i saw this one:
NxReal UpdateTime()
{
    NxReal deltaTime;
#ifndef LINUX
    static __int64 gTime,gLastTime;
    __int64 freq;
    QueryPerformanceCounter((LARGE_INTEGER *)&gTime);  // Get current count
    QueryPerformanceFrequency((LARGE_INTEGER *)&freq); // Get processor freq
    deltaTime = (double)(gTime - gLastTime)/(double)freq;
    gLastTime = gTime;
#else
    struct timeval tv;
    static struct timeval lasttv = { 0 , 0 };
    if (lasttv.tv_usec == 0 && lasttv.tv_sec == 0)
        gettimeofday(&lasttv, NULL);
    gettimeofday(&tv, NULL);
    deltaTime = (tv.tv_usec - lasttv.tv_usec)/1000000.f
        + (tv.tv_sec - lasttv.tv_sec);
    lasttv = tv;
#endif
    return deltaTime;
}

And in the physx wrapper i saw another example for xna which uses this other function:
public void Update( GameTime gameTime )
		{
			// Update Physics
			this.Scene.Simulate( (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0f );
			//_scene.Simulate( 1.0f / 60.0f );
			this.Scene.FlushStream();
			this.Scene.FetchResults( SimulationStatus.RigidBodyFinished, true );

			this.Camera.Update( gameTime );
		}

How can i adaptone of this functions to visual basic to my slimdx test?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement